Client-side web form validation is an usual task that every web developers / programmers should have done before, but it seems to me I never find a generic and reusable way to do it. Every time I got a form validation job request, I am copying code from here and there and hence writing bloated code at the end.
Then recently I came across with an excellent article about form validation with JavaScript by Mattias Hising (actually the article was posted last year..:P), which leads me to a reusable validation framework: jQuery validation plugin.
Despite of the file size (it requires jQuery 1.2.6 + and another 23kb validation plugin js, though you can use Gzip to compress them into relatively small size), I found the plugin quite promising. The most important thing is that the plugin is extensible so that you can actually write your own validation rules and add it to the framework without obstructing the validation mechanism. J. Eggers has posted an article that teach you how to extend the framework by writing your own validation script, another nicely done tutorial. You can find here: How to write custom validation rules.
Thought I will try to write some custom rules and put it here as my own homework.
no comments
RSS / trackback