[jQuery] [validate] Ignore hidden form fields from the validation
Hello!
I am currently hiding or showing specific form fields depending on
specific conditions. Only if the field is hidden they are still used
to validate against when submitting the form. Are there any ways to
ignore any field validations when the element is hidden? Because when
the field is hidden it doesn't have to be filled in.
Any way to solve this? I am currently using code like this:
$("#question_2").click(function() {
var itemValue = $("#question_2").val();
var toggleItems =
$("#field-question_11,#field-question_12,#field-question_13");
var condition = eval("itemValue == 'd'");
if ( condition ) { toggleItems.show() } else { toggleItems.hide() };
});
Yours,
Weyert de Boer