Don't ask to ask, just ask | |
PerlMonks |
Re: How do I write a CGI script with form validation?by rhythmicus (Sexton) |
on Aug 16, 2004 at 11:20 UTC ( [id://383256]=note: print w/replies, xml ) | Need Help?? |
Without knowing all the details, I'd say your best bet would be to validate the user input via JavaScript. Since JavaScript is client-side, you won't need to send the user input to the server and then back again if it's incorrect. As for outputting the results of your calculations, etc., you can do this the simple way with CGI, or the slightly more complicated way, although with more control and cleaner code, with HTML::Template. This kind of stuff is very common. Search this site and Google for more information. UPDATE: As some other monks have caught a mistake in my original post, I should add that I neglected to mention that user input should ALSO be checked at the server-side. However, contrary to what tachyon says, I do believe that JavaScript provides additional security and does have some degree of reliability. UPDATE Part II: For a good example of using JavaScript to help validate input, check out http://developer.apple.com/internet/webcontent/validation.html.
In Section
Seekers of Perl Wisdom
|
|