Name

popup_menu

Synopsis

print $query ->popup_menu('name', \@array [,’selected', \%labelhash ])

Description

Generates a popup menu.

name

The name to assign the input to (required).

\@array

An array reference listing the menu items. You can also use an anonymous array reference (see example below).

selected

The menu item to be initially selected (default is first menu item or the item selected in previous queries).

\%labelhash

A hash reference listing labels for each menu item. Default is menu item text. For example:

%labels = ('UPS'=>'United Parcel Service (UPS)',
         'FedExO'=>'Federal Express Overnight - 10AM delivery',
         'FedExS'=>'Federal Express Standard - 2PM delivery',
         'FedEx2'=>'Federal Express 2nd Day Delivery');

print $query->popup_menu('delivery_method', 
                       ['UPS', 'FedExO', 'FedExS', 'FedEx2'], 
                       'FedExO', 
                       \%labels);

Using named parameters, the syntax is:

print $query->popup_menu(-name=>'name',
                         -values=>\@array,
                         -default=>'selected',
                         -labels=>\%labelhash,
                         -onChange=>function,
                         -onFocus=>function,
                         -onBlur=>function);

Get Perl in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.