属性名称 | Type | Required | Default | Description |
---|---|---|---|---|
values | array | Yes, unless using options attribute | n/a | an array of values for dropdown |
output | array | Yes, unless using options attribute | n/a | an array of output for dropdown |
selected | string/array | No | empty | the selected option element(s) |
options | associative array | Yes, unless using values and output | n/a | an associative array of values and output |
name | string | No | empty | name of select group |
html_options is a custom function that creates html option group with provided data. It takes care of which item(s) are selected by default as well. Required attributes are values and output, unless you use options instead.
If a given value is an array, it will treat it as an html OPTGROUP, and display the groups. Recursion is supported with OPTGROUP. All output is XHTML compatible.
If the optional name attribute is given, the <select name="groupname"></select> tags will enclose the option list. Otherwise only the option list is generated.