print $query->checkbox(-name=>'checkbox_name',
-checked=>'checked',
-value=>'ON',
-label=>'CLICK ME');
-or-
print $query->checkbox('checkbox_name','checked','ON','CLICK ME');
checkbox
is used to create an isolated checkbox that isn't
logically related to any others.
- Parameters:
-
-
The first parameter is the required name for the checkbox (-name). It will
also be used for the user-readable label printed next to the checkbox.
-
The optional second parameter (-checked) specifies that the checkbox is
turned on by default. Synonyms are -selected and -on.
-
The optional third parameter (-value) specifies the value of the checkbox
when it is checked. If not provided, the word ``on'' is assumed.
-
The optional fourth parameter (-label) is the user-readable label to be
attached to the checkbox. If not provided, the checkbox name is used.
The value of the checkbox can be retrieved using:
$turned_on = $query->param('checkbox_name');
JAVASCRIPTING: checkbox
recognizes the -onClick
parameter. See checkbox_group
for further details.