Since the release of the JQuery Validation Plugin version 1.9.0
, hidden fields have been automatically omitted from validation checks [source].
According to the release notes, the way to get around this is by setting ignore: []
in the validation function.
Using version 1.10.0
, I am unable to get this to work for input fields that are hidden using display: none
or visibility: hidden
.
My validation is done using classes (eg, class="required"
) and the validation function is fairly basic:
JQuery
$("form").validate({
ignore: [],
errorPlacement: function(error, element) {
error.appendTo( $('#error-message') )
},
invalidHandler: function() {
//do something
},
submitHandler: function() {
//do something else
}
});
Working example: http://jsfiddle.net/fbCVY/
Can anyone point out where I am going wrong?
submit
button always shows "no error" in the console - even after removing the CSS that hides the input fields. Am I missing something, or is the jsfiddle not really set up to fail the validation? – TLS