Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Web Application Development with Form Validation

by Withigo (Friar)
on Feb 05, 2008 at 02:14 UTC ( #666176=note: print w/ replies, xml ) Need Help??


in reply to Web Application Development with Form Validation

If it's really important to keep the existing data which the user has entered so far, I'd say validation via ajax is going to be much easier than the "crazy loops" you mentioned. So this is really more of a javascript question than a perl question.

Using prototype.js (or if you know jquery) you basically make a regular form which has its onsubmit() handler set to make the ajax call and return false. So the browser won't attempt to change to another page. (Incidentally and off-topic, but for a good example, code like this is what the Rails function "form_remote_tag" auto-generates).

The perl side will be very minimal--just collect the params, validate them however you want and return some JSON with the rejected params, or with a flag indicating success. There are many examples of code like this to be found on the prototype mailing list (archived on google groups).


Comment on Re: Web Application Development with Form Validation

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://666176]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2014-12-28 22:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (183 votes), past polls