HTML::Template recalling selected dropdown optionsby bradcathey (Prior)
|on May 12, 2005 at 00:31 UTC||Need Help??|
bradcathey has asked for the
wisdom of the Perl Monks concerning the following question:
While I have seen this addressed indirectly in various nodes, I haven't been able to find anything definitive.
Here's the scenario: a user selects an option from a pulldown menu and submits a form. My script validates the input, finds a problem, and re-outputs the .tmpl page with the error message.
The associate => $query re-populates text boxes, but I have to rely on some hand-rolled code to re-set any dropdowns.
The code consists of: 1) 'onsubmit' Java-the-script to populate a like-number of hidden fields with the indexes of the options selected; 2) then Perl to grab those and pass them back to H::T if necessary (an error is found); and finally, 3) more JS to reset the dropdowns 'onload'ing. Messy, indeed. Question: What is the better, more Perlish, way? Thanks!
Update: fixed tags
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot