Posts Tagged ‘script’

Easy JavaScript client-side form validation

Wednesday, June 3rd, 2009

When you are developing a website or an application, there will come a moment that you have to start using Javascript to validate your HTML forms. Here you have 4 options. Option one is not to validate. Although tempting, it is not the best option to use. Option two is to depend on your application framework and hope they have implemented client-side validation into it besides the server-side validation. Option three is to custom code some basic validation scripting yourself.
This is a great way to learn more about Javascript, but also the figurative pain in the butt. Option four and final option is to grab a existing Javascript validation framework from the Net and use it. I would recommend option four which brings me to the actual goal of my post

Many Javascript validation frameworks that are available have one thing in common. You MUST code Javascript to use it. And this is just the thing you are trying to avoid. Spry is a nice example here. Very powerful framework, but you have to know about Javascript to use it. Would it not be nice that u can use a Javascript validation framework without having to know Javascript. I know some designers would love it, since they do not have to depend on other developers for the Javascript. On the other side. I as a developer can spend my time on other issues besides validation coding. That mean that I will have more time if I provide my designer with a non intrusive way to implement client-side Javascript validation.

(more…)