CGI::Test::Form::Widget::Menu - Abstract representation of a menu
# Inherits from CGI::Test::Form::Widget
This class is the abstract representation of a menu from which one can choose one or several items, i.e. either a popup menu or a scrollable list (with possibly multiple selections).
There is an interface to query the selected items, get at the presented labels and associated values, and naturally
The interface is the same as the one described in CGI::Test::Form::Widget, with the following additions:
An hash reference, recording valid menu values, as tuples (value => count), with count set to the number of times the same value is re-used amongst the proposed options.
Whether menu allows multiple selections.
A list reference, providing the labels to choose from, in the order in which they appear. The retained labels are either the content of the <OPTION> elements, or the value of their
label attribute, when specified.
A list reference, providing the underlying values that the user chooses from when he selects labels, in the order in which they appear in the menu.
An hash reference, whose keys are the selected values.
The amount of currently selected items.
Mark the option value as selected. If
multiple is false, any previously selected value is automatically unselected.
Note that this takes a value, not a label.
Unselect an option value. It is not possible to do that on a popup menu: you must
select another item to unselect any previously selected one.
Test whether an option value is currently selected or not. This is not testing a label, but a value, which is what the script will get back eventually: labels are there for human consumption only.
There is an additional predicate to distinguish between a popup menu (single selection mandatory) from a scrolling list (multiple selection allowed, and may select nothing).
Returns true for a popup menu.
Although documented, those features are more targetted for internal use...
Change the selection status of an option value.
You should use the
unselect convenience routines instead of calling this feature.
The original author is Raphael Manfredi.
Steven Hilton was long time maintainer of this module.
Current maintainer is Alexander Tokarev <email@example.com>.