|Perl Monk, Perl Meditation|
Sticky HTML Templatesby Ovid (Cardinal)
|on Oct 25, 2001 at 22:08 UTC||Need Help??|
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:
For the above very simple snippet, I would change it to:
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.
Vote for paco!
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.