Ovid has asked for the wisdom of the Perl Monks concerning the following question:
If you've worked with CGI.pm for any length of time, you know that forms are automatically sticky when using the HTML generating functions. However, when using alternatives such as HTML::Template or Template Toolkit (which is what I am using), then you have to manually add the 'sticky' action to the templates. This can be a lot of work. For example, I might have some HTML like this:
<input type="text" name="username" value="" maxlength="20" />
For the above very simple snippet, I would change it to:
<input type="text" name="username" value="[% username %]" maxlengt +h="20" />
Naturally, it becomes considerably more complicated when dealing with <select> tags and things like that.
Of course, then I need to go through and write the code that actually grabs and untaints the data and, if incomplete, returns the user to the form with this data already filled in. After writing this stuff for the umpteenth time, I've decided to write a code generator which will create the template and the shell of the CGI script for me. I'm basing this on this code generator that I wrote a while ago. However, this has been a fair amount of work and I'm curious to know if this has already been done. I haven't found any code out there that already does this, but this is so common that I can't imagine that no one has done this before.
Cheers,
Ovid
Vote for paco!
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Sticky HTML Templates
by Masem (Monsignor) on Oct 25, 2001 at 22:16 UTC | |
by boo_radley (Parson) on Oct 25, 2001 at 22:23 UTC | |
by Ovid (Cardinal) on Oct 25, 2001 at 22:37 UTC | |
by brother ab (Scribe) on Oct 26, 2001 at 11:11 UTC | |
Re: Sticky HTML Templates
by perrin (Chancellor) on Oct 26, 2001 at 00:33 UTC | |
by Ovid (Cardinal) on Oct 26, 2001 at 02:51 UTC | |
by perrin (Chancellor) on Oct 27, 2001 at 11:51 UTC |