|Just another Perl shrine|
Is there room for YAHTMLM?by jbeninger (Monk)
|on Feb 27, 2003 at 19:27 UTC||Need Help??|
...meaning Yet Another HTML Module. I've come up with a module called FormManager.pm that I've been using quite a bit in recent projects. I'd like the opinions of the fine monks around here as to whether it's worth turning into a CPAN module, or if it's the hacked-up, cobbled-together redundant version of something else as is often the case. For me, it's shaved off quite a bit of development time. Here's an example
There are numerous features this provides over pure CGI.pm.
1) It's easily extensible. For instance, one could create a FormManager::Date component which consists of three select boxes for month/day/year. In your code, you could treat this as a single input.
2) Validation. This module can validate in a number of ways. So you can use the premade options like 'phone', 'integer', etc, or create your own. Select boxes are automatically checked to ensure the value matches one of the options presented. Validation of all form components is done with a single call to processQuery($query).
3) Easy user-friendliness. If someone enters an incorrect value, or leaves out required information, simply call $fm->getHtml() again after validation. FormManager will fill in all of the old values so that the user doesn't have to re-enter an entire form because of one mistake.
Thanks in advance for the perl-wisdom of the ages.