In the new version of jQuery validation plugin 1.9 by default validation of hidden fields ignored. I'm using CKEditor for textarea input field and it hides the field and replace it with iframe. The field is there, but validation disabled for hidden fields. With validation plugin version 1.8.1 everything works as expected.
So my question is how to enable validation for hidden fields with v1.9 validation plugin.
This setting doesn't work:
$.validator.setDefaults({ ignore: '' });
Best Answer
The plugin's author says you should use "square brackets without the quotes",
[]
http://bassistance.de/2011/10/07/release-validation-plugin-1-9-0/
To change this setting for all forms:
(It is not required that
.setDefaults()
be within thedocument.ready
function)OR for one specific form:
EDIT:
See this answer for how to enable validation on some hidden fields but still ignore others.
EDIT 2:
Before leaving comments that "this does not work", keep in mind that the OP is simply asking about the jQuery Validate plugin and his question has nothing to do with how ASP.NET, MVC, or any other Microsoft framework can alter this plugin's normal expected behavior. If you're using a Microsoft framework, the default functioning of the jQuery Validate plugin is over-written by Microsoft's
unobtrusive-validation
plugin.If you're struggling with the
unobtrusive-validation
plugin, then please refer to this answer instead: https://stackoverflow.com/a/11053251/594235