How do I disable "eager" validation entirely using jquery validate?
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 - aft开发者_开发知识库er 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.
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
});
精彩评论