jQuery validate--don't validate until user input entered and field blurred at least once
Hi All,
If you take a look at this form:
You'll notice one problem: it immediately triggers all validation after you enter a single keystroke in any textbox. For instance, if you start typing in the email field, after a single keystroke you will get a validation error.
This seems in direct contradiction to the descriptive text below the example form, which says:
- Before a field is marked as invalid, the validation is lazy: Before submitting the form for the first time, the user can tab through fields without getting annoying messages - he won't get bugged before he had the chance to actually enter a correct value
- Once a field was marked invalid, it is eagerly validated: As soon as the user entered the necessary value, the error message is removed
- If the user enters something in a non-marked field, and tabs/clicks away from it (blur the field), it is validated - obviously the user had the intention to enter something, but failed to enter the correct value
This describes the desired behavior--no "annoying error messages" until the user either a) submits the form or b) enters data into a field
and blurs the field. But what is actually happening in the demo is that validation is triggered after the first keystroke, and
not after the field is blurred. Thus, the user is bombarded with "annoying error messages" that distract him from what he's doing. We want happy users, not annoyed users :-)
How can I get the behavior described in the text, rather than the behavior in the demo?
Thanks!
-Josh