CGI::Test::Form::Widget::Box - Abstract representation of a tickable box
# Inherits from CGI::Test::Form::Widget
This class is the abstract representation of a tickable box, i.e. a radio button or a checkbox.
To simulate user checking or un-checking on a box, use the check() and uncheck() routines, as described below.
check()
uncheck()
The interface is the same as the one described in CGI::Test::Form::Widget, with the following additions:
group
The CGI::Test::Form::Group object which holds all the groups of the same widget type.
CGI::Test::Form::Group
group_list
The list of widgets belonging to the same group as we do.
is_checked
True when the box is checked, i.e. marked with a tick.
check
Check the box, by ticking it.
check_tagged
This may be called on any box, and it will locate the box whose value attribute is tag within the group_list, and then check it.
If the specified tag is not found, the caller will get a warning via carp.
carp
uncheck
Uncheck the box, by removing its ticking mark. It is not possible to do this on a radio button: you must check another radio button of the same group instead.
uncheck_tagged
This may be called on any box, and it will locate the box whose value attribute is tag within the group_list, and then remove its ticking mark. It is not possible to do this on a radio button, as explained in uncheck above.
There is an additional predicate to distinguish between a checkbox and a radio button:
is_radio
Returns true for a radio button.
is_standalone
Returns true if the box is the sole member of its group.
Normally only useful for checkboxes: a standalone radio button, although perfectly legal, would always remain in the checked state, and therefore not be especially interesting...
Although documented, those features are more targetted for internal use...
set_is_checked
Change the checked status. Radio buttons can only be checked, i.e. the flag must be true: all other radio buttons in the same group are immediately unchecked.
You should use the check and uncheck 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 <tokarev@cpan.org>.
CGI::Test::Form::Widget(3), CGI::Test::Form::Widget::Box::Radio(3), CGI::Test::Form::Widget::Box::Check(3).
To install CGI::Test, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::Test
CPAN shell
perl -MCPAN -e shell install CGI::Test
For more information on module installation, please visit the detailed CPAN module installation guide.