HTMLDocument::addOptionList(3) Adds a set of checkboxes or radio buttons

SYNOPSIS

ElementTree addOptionList( ElementTree parent, String legend, String iname, [SelectOption] options, Bool allowmultiple=true )

ARGUMENTS

parent The parent element

legend The legend for the fieldset grouping the options

iname The name of the option controls. Remember that names starting with "kaya_" may be used by the Kaya standard library and should not be used directly by applications.

options The options to select from

allowmultiple This parameter is optional and defaults to true , which generates the option list as a set of checkboxes. If it is explicitly set to false then radio buttons are used instead.

DESCRIPTION

Adds a set of checkboxes or radio buttons to a form. The meaning of the parameters is very similar or identical to the similar parameters for HTMLDocument.addLabelledSelect(3kaya) , but the appearance is very different. If the number of options is not large, this is generally considerably easier to use than a selection drop-down, although it does take up much more screen space.

When using this function to generate radio buttons, you should ensure that one of the options is initially selected, as browser behaviour when no option is selected is variable and often causes problems. You may need to add a "no option selected" radio button for initial selection in some circumstances.


 options = [
     SelectOption("Express delivery","1",true),
     SelectOption("Standard delivery","2",false),
     SelectOption("Slow delivery","3",false)
 ];
 sel = addLabelledSelect(fieldset,"Select a delivery speed","choice",
                         options,false);
 /* // produces 
 <fieldset><legend>Select a delivery speed</legend>
   <div><input type='checkbox' name='choice' value='1' id='Kay1' 
                     checked='checked'>
     <label for='Kay1'>Express delivery</label></div>
   <div><input type='checkbox' name='choice' value='2' id='Kay2'>
     <label for='Kay2'>Standard delivery</label></div>
   <div><input type='checkbox' name='choice' value='3' id='Kay3'>
     <label for='Kay3'>Slow delivery</label></div>
 </fieldset>
 */ // exact markup may vary slightly to keep IDs unique in the document

AUTHORS

Kaya standard library by Edwin Brady, Chris Morris and others ([email protected]). For further information see http://kayalang.org/

LICENSE

The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation.

RELATED

HTMLDocument.SelectOption(3kaya)

HTMLDocument.addLabelledSelect(3kaya)

HTMLDocument.addOption(3kaya)