ElementTree addOptionList(ElementTree parent, String legend, String iname, [SelectOption] options, Bool allowmultiple=true)
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
falsethen radio buttons are used instead.
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 addLabelledSelect, 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