views:

37

answers:

1

I'm curious what the best method of web 2.0 form validation is...

I'm looking into: http://docs.jquery.com/Plugins/validation

And the claim to fame here is that it doesn't bother the user until he submits the form. However, that's what I want to happen. I don't want the user going through the entire form before he's informed that his email address is incorrectly formatted.

I've got several form within my project and I really want to use jquery to the best of it's ability... and so I don't have to keep writing code.

A: 

It's probably a matter of developer preference, But I fire my evaluations on blur() when I need to call attention to it immediately.

FatherStorm
Do you have that choice when using the Validation plugin?
dcolumbus
yes: from jQuery's site: Validates the selected form.This method sets up event handlers for submit, focus, keyup, blur and click to trigger validation of the entire form or individual elements. Each one can be disabled, see the onxxx options (onsubmit, onfocusout, onkeyup, onclick). focusInvalid focuses elements when submitting a invalid form.
FatherStorm
http://docs.jquery.com/Plugins/Validation/validate
FatherStorm
Thank you. Is there an example form set up somewhere where I can this plugin in action? All of the individual snippets aren't very useful.
dcolumbus
What I've noticed is that the "onfocusout" only executes after the form was submitted once. Is there an option that I'm not seeing?
dcolumbus
Let's say you set you validation at the element ID level. associate it wit onBlur, and that means that it has to have held focus, and the nex element they move to fires the validation, whether from tabbing or from clicking. If you don't want them to be able to click Submit, then disable it initially on page load, and then enable it once all your validation rules have been satisfied.
FatherStorm