http://qs321.pair.com?node_id=602301


in reply to altering existing form

Your question isn't really very clear, but it sounds like you have an existing textfield that you want to change to be a popup menu, and you want to populate that menu with the contents of your department list.

Somewhere, probably in the form template that you didn't show us, you have a textfield definition containing HTML like that which could be produced by this code:

my $dept_control = $cgi->textfield(-name=>"dept", -size=>12, -maxlength=>12, -default=>$some_default_value);

You want to change that textfield to a popup menu, maybe like this:

my $dept_control = $cgi->popup_menu(-name=>"dept", -values=>\@dept);

Update: I'm not sure how to create complex form controls using HTML::Template -- usually I create 'em up front using CGI and then I pass the fully-constructed controls to the template as a TMPL_VAR. You might want to have a look at the docs for CGI.