Chad,

<snippet>
sub processSelect{
my ($selectName, @selectValues, $selection) = @_;
}
</snippet>
Here you assign element[0] of @_ to $selectName.  Then you assign all
remaining elements (indexes 1 through infinity) to @selectValues. 
@selectValues slurps up all remaining elements of @_ leaving poor
little $selection to starve to death.   Try this...

sub processSelect{
my ($selectName, $selection, @selectValues) = @_;
}
</snippet>
You will have to modify all the callers of processSelect accordingly
though.

Kristofer
--- Chad A Gard <[EMAIL PROTECTED]> wrote:
> I'm having difficulty creating a popup menu.  I want a select list, 
> like so:
> 
> <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]
> 


=====
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GIT d s+:++ a C++ UL++ US+ P+++ L++ 
W+++ w PS PE t++ b+ G e r+++ z++++
------END GEEK CODE BLOCK------

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to