Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Dynamically marking a HTML select option as selectedby ezekiel (Pilgrim) |
on Dec 19, 2001 at 10:05 UTC ( [id://133024]=perlquestion: print w/replies, xml ) | Need Help?? |
ezekiel has asked for the wisdom of the Perl Monks concerning the following question: I have an CGI application where a user can create a database entry by completing an HTML form. Later, the user may want to retreive an entry, edit it, and store it back in the database. I plan to do this by extracting the values from the database and producing the same HTML form but with these values inserted as the "default" values. This works fine for text boxes by just adding a value="$existing_value" to the <input type="text" name="my_parameter"> widget. However, I run into a problem when using a <select> widget. The only way I can think of doing it is to put it inside an if/then statement as such:
This is really ugly, especially if the select has a large number of possible options. Does anyone have any better suggestions as to how this might be done? Any modules that may help? Thanks.
Back to
Seekers of Perl Wisdom
|
|