Clear questions and runnable code
get the best and fastest answer
Automatic Generation of Form Handling Codeby Ovid (Cardinal)
|on Jun 06, 2001 at 21:21 UTC||Need Help??|
Ovid has asked for the
wisdom of the Perl Monks concerning the following question:
I asked this in the chatterbox but somehow things got a bit "confused", so I'm providing a better explanation. Note that this is not a "do my job for me" post. I am planning on writing this (and posting it here), but if it's already written, I'd love to know!
Recently, I've been handed a mock-up of a huge Web-based application. Many of the forms have 40 or more elements in them. What I have been looking for is a script that will read in HTML forms and automatically generate a code skeleton that will:
In short, I'd like something that will take the following HTML form and create a Perl skeleton for it:
The HTML above is deliberately formatted poorly because I'd prefer a robust solution. A code template generated from this would resemble the following:
Note that taint checking is based upon the values already present in the form with a default of \w+ if no value attributes are present in the HTML. Also, it would automatically change the scalar to an array for multi-valued elements (the checkbox group).
If something like this exists (okay, merlyn, which of your columns did I miss? :), please let me know. If it doesn't exist, advice welcome.
I think the benefits of such a script are obvious:
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.