Do you know where your variables are? | |
PerlMonks |
Should you need javascript too.by emazep (Priest) |
on Feb 13, 2005 at 03:57 UTC ( [id://430517]=note: print w/replies, xml ) | Need Help?? |
Data::FormValidator is great, but it unfortunately doesn't also generate javascript validation code.
Though client-side javascript validation does not offer any reliability when used as the only validation stage, since it can be easily bypassed, when coupled with server-side (Perl) validation proves to be extremely precious in almost any web application.
It's precious because the client data does not have to reach the server to be validated, so you can save both bandwidth and server CPU cycles by intercepting wrong data right on the client machine, thus alleviating both your network connection and your server from receiving the wrong data, checking them and sending back the form again (possibly several times before a successful form submission.) So you could now think that it's a nightmare to keep in sync both Perl and javascript validation code (and you would be right, if you should do it by hand,) but what about if you could define your validation code just once (even in a declarative manner,) and get your Perl (server-side) validation code, and then get also javascript (client-side) validation code for free?!
Well, such a sweet thing is provided by (at least) two modules I'm aware of: CGI::Ex::Validate by Paul T. Seamons and CGI::FormBuilder by Nathan Wiger.
Ciao,
In Section
Seekers of Perl Wisdom
|
|