[Previous] [Contents] [Next]


Listboxes

Listboxes are fields that contain a scrollable list of text strings for single or multiple selection. You can use listboxes for such things as specifying a state (single selection) or product of interest (multiple selection). Use the SELECT and OPTION tags, as shown in the following lines, to create a listbox:

<SELECT NAME='State' SIZE=3>

 <OPTION>CA

 <OPTION>WA

 <OPTION>OR

 <OPTION>NV

 <OPTION>AZ

 </SELECT>


Using CGI::Form, this calls the scrolling_list method:

@states=( `CA', `WA', `OR', `NV', `AZ' );

 $q->scrolling_list( -name=>'State', -values=>\@states, -default=>'CA',

                     -size=>3 );


The nice feature of using scrolling_list in CGI::Form is that the options can be stored within Perl arrays, which makes working with the data easier.

[Previous] [Contents] [Next]