Project

Contents

Issue #00005593

Added optgroups to <tml:input type="select">
Feature/Improvement

<tml:input type="select"> currently is not able to create optgroup-s. This has been changed now.

We added a new attribute "optgroupsitem" to <tml:input> to handle this. The referenced item must be a list of map objects with properties "label" an "options".

Sample:

<tml:script>
    _optgroups = [
        {
            label: "languages",
            options: [
                "german|de", 
                "english|en"
            ]
        },
        // next optgroup ...
    ]
</tml:script>
<tml:input name="lang" optgroupsitem="_optgroups"/>

"optgroupsitem" can be combined with "options" or "optionsitem". Standard options are rendered first in this case.

<tml:input name="lang" options="1,2,3" optgroupsitem="_optgroups"/>

Renderes:

<select name="lang">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <optgroup label="languages">
        <option value="de">german</option>
        <option value="en">english</option>
    </optgroup>
</select>