checkbox - print checkbox list

 

SYNOPSIS

<checkbox $name $values $selected $output
          [$classes [$ids [$titles]]]>


DESCRIPTION
The checkbox function generates a list of checkboxes (HTML <INPUT TYPE=checkbox> tags), one for each value of $output. The $name list is the name of the tag; if it has fewer values than $output the last name is re-used. The $values list is the list of VALUE attribute values. Values that match a value of $selected are set CHECKED. The $output list is the list of user-visible values. If $values has fewer values than $output, the corresponding $output values are used.

In version 5.01.1219783000 20080826 and later, the output is XHTML 1.0 Strict compliant, and the optional $classes and $ids arguments may be given. The $classes argument is a parallel list of class attribute values to set; if the list is short, the last value is re-used. If no values (or a single empty value) is given, no class attributes are set.

The $ids argument is a parallel list of HTML id attribute values to set; if the list is short, the last value is re-used, but with its last numeric section incremented each time (to make it unique). This allows control of the starting id value, yet still lets the function handle the rest of the sequence. If no values (or a single empty value) is given, the ids are named after $name with an incrementing number.

In version 5.01.1225758000 20081103 and later, an optional $titles argument may be given. If non-empty, each value specifies the title attribute to set for the corresponding item.

Each $output value is printed in a <label> associated with its checkbox via the id, so that clicking on the displayed text also toggles the checkbox, making it easier to click.


DIAGNOSTICS
checkbox returns nothing.


EXAMPLE

<$values = red green yellow blue><$selected = green>
<checkbox "color" $values $selected $values>


CAVEATS
The checkbox function was added Sep. 20 1996. The $classes and $ids arguments were added in version 5.01.1219783000 20080826. There must be at least one $name value.


SEE ALSO
options, radiobutton


Copyright © Thunderstone Software     Last updated: Dec 10 2018
Copyright © 2019 Thunderstone Software LLC. All rights reserved.