radiobutton - print radio buttons list

 

SYNOPSIS

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


DESCRIPTION
The radiobutton function generates a list of radio buttons (HTML <input type="radio"> 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, with the convenience of the function making the rest of the sequence unique. 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 radiobutton via the id, so that clicking on the displayed text also toggles the radiobutton, making it easier to click.


DIAGNOSTICS
radiobutton returns nothing.


EXAMPLE

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


CAVEATS
The radiobutton 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, checkbox


Copyright © Thunderstone Software     Last updated: Sep 25 2019
Copyright © 2019 Thunderstone Software LLC. All rights reserved.