views:

122

answers:

1

Is there a way to disable "eager" validation using the jquery.validate plugin? Either through an option in the script or as a hack? "Eager" validation kicks in once the form has been validated once - after that, invalid fields are validated onfocusout. I want to disable this behavior, and change my forms to only be validated when the submit button is pressed.

I don't mind hacking through the validate script itself also, so if that's what the solution requires that's acceptable.

+2  A: 

Check out the onfocusout option.

onfocusout, boolean, default:true

"Validate elements (except checkboxes/radio buttons) on blur. If nothing is entered, all rules are skipped, except when the field was already marked as invalid."

About halfway down.

So to disable "eager" validation:

$(".selector").validate({
  onfocusout: false
});
GlenCrawford
Exactly what I was looking for, thanks
Kevin J