The select widget represents a labelled single select dropdown. The selected result can be bound to a variable with a basic data type, object instance, object instance attribute or an custom enum variable.
The default initial value for binding is null and is displayed as "Not Specified" on the widget.
The collection source for the widget that will be displayed can be a collection of basic data types, an object collection or an enum.
In the case of an object collection as source, one or more attributes can be specified to be displayed in the dropdown list.
The title is specified as a key to a lang file entry and is required. Visibility bindings are also supported.
The select widget can be used to submit the values on a view to the backend.
Example
Enum as collection source
The abbreviated code snippets and screenshots below shows the use of <select/> with a custom enum as collection source.
Model enum and object attribute
enum STATES {
West_Coast,
South_Coast,
Inland
}
persistent object Farmer {
.
.
STATES state;
.
.
}
<select> with basic data type collection as collection source
Submit view on change event
An attribute called submitOnChange can be declared on a view, when this is set as "true" the view will be submitted to Helium when an option of the select is clicked by the user. The submit event will bind user input to the unit variables and reload the view in the same way as the <submit/> widget. The use case for doing this is to filter results displayed on a view when a user selects an item from a select dropdown, without the need to click a submit button.
In the following example, when a user selects a value from the rendered select widget then the view will be submitted.
Add Comment