If I read the documentation for that module correctly, one needs to define the HTML in the form prefered by that module, and it generates both the HTML and the code that sets the values on subsequent calls. That approach has a lot to recommend it, but sometimes it complicates things.
If you have an external designer putting together your web pages, (and/or if you're using some other templating system,
such as HTML::Template), you could use another solution. HTML::FillInForm will parse an existing HTML file, and put in the values you provide.
Obviously, that is slower, since the form has to be parsed each time. On the other hand, it will save you oodles of time each time the external designer has to change the whole look of the form to satisfy the customer's whim. | [reply] |
I'm not seeking a templating system; I'm seeking a form-making module. Check our merlyn's article here to get the gist of what I am seeking.
In this article, Randal defines a form and its form checking logic through one data structure (in this case, @QUESTIONS), then has a routine display and validate and retain-values-on-partial-form-completion the form. He used an eval block for this simple example.... I was wondering if there was a more robust module for this around. (Often in Perl something seems initially easy but then it turns out there are important subtleties and the problem isn't easy -- for example, consider all the regexp-based html 'parsers', or consider all the Date modules --
which has taught me that trolling CPAN for well-written code is well worth it, before starting in grinding out code.)
Hence my initial question still stands.....
water | [reply] [d/l] [select] |
I usually create a line like ##FOOBAR## wherever I want the value of the users $foobar variable to be inserted, which I fetch from a database. I then just run a $web_page =~ s[##FOOBAR##][$foobar]sg; for the web page. It's kind of crude but it works really well. I suppose you maybe want to do something more complicated? What exactly are you looking to do?
Want to support the EFF and FSF by buying cool stuff? Click here.
| [reply] [d/l] |
| [reply] |
I usually don't have very complicated web pages so it's always seemed easy enough to do what I've done. Can you be more specific then "For the love of god, HTML::Template"? You don't make a very convincing case for why I should learn an entire templating system for a few substitutions. Now, I am sure you have good reasons for why I should use HTML::Template, but can you elaborate? I'd love to improve my code.
Want to support the EFF and FSF by buying cool stuff? Click here.
| [reply] |