multilist
Description
Wpart responsible for creating a list of multiple choices. It could be either a multiple selection or single selection list. The values stored on the Erlang Web framework side are kept in list (even if the selection is set to the single type, the one element list is kept).
It is possible to specify the preselected values.
The rendered widget is:
<select ...> <option ...>Desc</option> ... </select>
HTML meta-attributes
name |
format |
description |
options |
"Val1:Desc1 | Val2:Desc2 | ..." |
The options could be selected. The string is actually a list of possible options: they are separated with a | character (pipe). Each of the choice consists of value that should be set as an HTML value (and passed to the validator) and human-readable description (rendered only on form, not present in the persistence layer). Value and description are separated with : sign (colon). |
selected |
"Val1|Val2|Val3" |
The values that should be preselected. The delimiter is a | (pipe). |
Examples
Records definitions
...
{multilist, [{options, "dog:Doggy|cat:Kitten|rhino:Other"},
{selected, ["cat", "rhino"]}
%% other parameters
]
},
...
HTML tag
<wpart:multilist options="dog:Doggy|cat:Kitten|rhino:Other" selected="cat|rhino" multiple="multiple" OTHER_HTML_ATTRIBUTES />
