OpenWGA 7.11 - WebTML reference

WebTML tags » input

<tml:input optionsitem ="item-name">

Purpose:

This is an alternative way to specify options for this input. The attributes names an item or WebTML variable which contains a list defining the options to use.  Each list element defines one option. You may specify option values only or option title and option value divided by a pipe symbol "|".  If you do not specify titles you may also let them be calculated by attribute optionstitle.

If you want WebTML to automatically retrieve options for a HDBModel relation then you need to omit both attributes options and optionsitem.

Examples:

A simple color selection box:
<tml:script>
     _colors = createlist();
     _colors.add("green|g");
     _colors.add("yellow|y");
     _colors.add("blue|b");
</tml:script>

<tml:input name="color" type="select" optionsitem="_colors"/>


A more complex example with a selectbox showing all child documents of the current document:
<tml:script>
    var docs = content().getStructEntry().getChildEntries();
    theOptions = createList();
    for (var idx=0; idx < docs.size(); idx++) {
        var doc = docs.get(idx);
        theOptions.add(doc.getTitle() + "|" + doc.getStructKey());
    }
</tml:script>

<tml:input name="subdocs" type="select" optionsitem="theOptions"/>