<select name="phoneLabel"> <option value="Work">Work <option value="Home" selected>Home <option value="Mobile">Mobile <option value="Pager">Pager <option value="Home Fax">Home Fax <option value="Work Fax">Work Fax </select>
It seems I should be able to get that by doing (simplified, of course. Really data is coming from a db, and I have several different select lists):
@phoneLabels = ('Work', 'Home', 'Mobile', 'Pager', 'Home Fax', 'Work Fax');
$phoneSelect = 'Home';
$phoneLabelSelect = &processSelect("phoneLabel", @phoneLabels, $phoneSelect);
sub processSelect{
my ($selectName, @selectValues, $selection) = @_;
my $selectList = $query->popup_menu(-name=>$selectName,
-values=>[EMAIL PROTECTED],
-default=>$selection);
return $selectList;
}
print $phoneLabelSelect;
but, instead of what I want (above), I get: <SELECT NAME="phoneLabel"> <OPTION VALUE="Work">Work <OPTION VALUE="Home">Home <OPTION VALUE="Mobile">Mobile <OPTION VALUE="Pager">Pager <OPTION VALUE="Home Fax">Home Fax <OPTION VALUE="Work Fax">Work Fax <OPTION VALUE="Home">Home </SELECT>
with work (as the first option) being selected. It basically just appends the -default value to the end of the option list. What am I missing? What I've done seems to be in line with the cgi.pm doc:
CREATING A POPUP MENU ...
-or (named parameter style)-
print $query->popup_menu(-name=>'menu_name', -values=>['eenie','meenie','minie'], -default=>'meenie', -labels=>\%labels);
...
1. The required first argument is the menu's name (-name).
2. The required second argument (-values) is an array reference containing the list of menu items in the menu. You can pass the method an anonymous array, as shown in the example, or a reference to a named array, such as "[EMAIL PROTECTED]".
3. The optional third parameter (-default) is the name of the default menu choice. If not specified, the first item will be the default. The values of the previous choice will be maintained across queries.
...
Help?
Chad A Gard http://www.percussionadvocates.com/chad
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]