Page 1 of 1

Recommend a javascript form validator

Posted: Mon Aug 13, 2007 9:04 am
by JayBird
I've been looking around at some of the form validation library's built on different frameworks and was wondering what everyone is using.

Ive tried a few but some seem overly complicated and some don't seem to quite live up to the hype.

Posted: Mon Aug 13, 2007 9:33 am
by CoderGoblin
I have to admit that I am lazy. As you have to validate in PHP anyway (to easy to rig values otherwise even if it is a post) I don't bother to validate using javascript.

Posted: Mon Aug 13, 2007 9:40 am
by JayBird
Yep, i used to be like that, but things start getting tricky when in the same form you have multiple file upload forms.

Say the user has to select 5 files to upload, then submit the form for the fields to be checked, if there are any errors with any of the non-file fields, and the form is redisplayed, the user needs to select the files again (unless the files are uploaded and saved even if an error occurs).

I just think it leads to a better user experience by having JS validation coupled with PHP validation

Posted: Mon Aug 13, 2007 9:52 am
by CoderGoblin
In this instance, although a bit of potential overkill/extra traffic I would use AJAX. You only have to maintain one validation code block in PHP rather than keep PHP and javascript validations in sync.

Posted: Mon Aug 13, 2007 10:53 am
by matthijs
Or let php create the javascript (-array) so you only have to maintain one validation code block

Posted: Tue Aug 14, 2007 9:32 am
by JayBird
Anyway, back to the ACTUAL question.

Can anyone recommend any validation library's they use?!

Posted: Tue Aug 14, 2007 11:18 am
by matthijs
The ones I like are from the code libraries from the books:

- Modern web design using javascript and Dom by Stuart Langridge (sitepoint book)
- Beginning javascript with dom scripting and ajax by Christian heilmann.

I'm almost sure you can download the code examples even without buying the books.