The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CGI::Test::Form::Widget::Box - Abstract representation of a tickable box

SYNOPSIS

 # Inherits from CGI::Test::Form::Widget

DESCRIPTION

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.

INTERFACE

The interface is the same as the one described in CGI::Test::Form::Widget, with the following additions:

Attributes

group

The CGI::Test::Form::Group object which holds all the groups of the same widget type.

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.

Attribute Setting

check

Check the box, by ticking it.

check_tagged tag

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 logcarp.

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 tag

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.

If the specified tag is not found, the caller will get a warning via logcarp.

Widget Classification Predicates

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...

Miscellaneous Features

Although documented, those features are more targetted for internal use...

set_is_checked flag

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.

AUTHOR

Raphael Manfredi <Raphael_Manfredi@pobox.com>

SEE ALSO

CGI::Test::Form::Widget(3), CGI::Test::Form::Widget::Box::Radio(3), CGI::Test::Form::Widget::Box::Check(3).