4.12. checked
4.12.1. Summary
Parameters: name value
Positional parameters in same order.
The attribute hash reference is passed to the subroutine after the parameters as the last argument. This may mean that there are parameters not shown here.
Must pass named parameter interpolate=1 to cause interpolation.
Invalidates cache: YES
Called Routine:
ASP-like Perl call:
$Tag->checked( { name => VALUE, value => VALUE, } ) OR $Tag->checked($name, $value, $ATTRHASH); [checked name valueother_named_attributes]
Parameters | Description | Default |
name | DEFAULT_VALUE | |
value | DEFAULT_VALUE |
Attributes | Default |
ATT1 | none |
interpolate (reparse) | No |
Other_Charactreristics | |
Invalidates cache | YES |
Container tag | No |
Has Subtags | No |
Nests | Yes |
Tag expansion example:
[checked name value] --- TAGRESULT
ASP-like Perl call:
$Tag->checked( { name => VALUE_name value => VALUE_value }, $body );
or similarly with positional parameters,
$Tag->checked(name,value, $attribute_hash_reference, $body);
4.12.2. Description
You can provide a "memory" for drop-down menus, radio buttons, and checkboxes with the [checked] and [selected] tags.
<INPUT TYPE=radio NAME=foo VALUE=on [checked name=foo value=on default=1]> <INPUT TYPE=radio NAME=foo VALUE=off [checked name=foo value=off]>
This will output CHECKED if the variable var_name is equal to value. Not case sensitive unless the optional case=1 parameter is used.
The default parameter, if true (non-zero and non-blank), will cause the box to be checked if the variable has never been defined.
Note that CHECKBOX items will never submit their value if not checked, so the box will not be reset. You must do something like:
<INPUT TYPE=checkbox NAME=foo VALUE=1 [checked name=foo value=1 default=1]> [value name=foo set=""]
By default, the Values space (i.e. [value foo]) is checked -- if you want to use the volatile CGI space (i.e. [cgi foo]) use the option cgi=1.