4.13. checked

4.13.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 value other_named_attributes]
Parameters Description Default
case   DEFAULT_VALUE
cgi   DEFAULT_VALUE
default   DEFAULT_VALUE
name   DEFAULT_VALUE
multiple   DEFAULT_VALUE
value   DEFAULT_VALUE
Attributes Default
interpolate (reparse) No
Other_Characteristics  
Invalidates cache YES
Container tag No
Has Subtags No
Nests Yes

Tag expansion example:

    [value name=example set=neato]
    <INPUT TYPE=checkbox NAME=neato VALUE=1 [checked name=neato value=1]>
    <INPUT TYPE=checkbox NAME=silly VALUE=1 [checked name=silly value=1]>
    <INPUT TYPE=checkbox NAME=neato VALUE=1 CHECKED>
    <INPUT TYPE=checkbox NAME=silly VALUE=1 >

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

Use the parameter default=1 to specify that this checkbox should be marked CHECKED if the value/CGI variable has never been set.

If the parameter multiple=1 is set, the value parameter can contain multiple (stacked) values that should be checked, separated by ASCII null characters ("\0" in Perl).

4.13.2.1. case

4.13.2.2. cgi

4.13.2.3. default

4.13.2.4. name

4.13.2.5. multiple

4.13.2.6. value