Select¶
-
/libs/granite/ui/components/foundation/form/select Select is a component to represent a concept of selection of some options.
It extends
Fieldcomponent.It has the following content structure:
-
granite:FormSelect
- granite:FormField
- idstring
The id attribute.
- relstring
The class attribute. This is used to indicate the semantic relationship of the component similar to
relattribute.
- classstring
The class attribute.
- titlestring
- i18n
The title attribute.
- namestring
The name that identifies the field when submitting the form.
- emptyTextstring
- i18n
The initial text to display when nothing is selected.
- disabledboolean
Indicates if the field is in disabled state.
- requiredboolean
Indicates if the field is mandatory to be filled.
- validationstring
- multiple
The name of the validator to be applied. E.g.
foundation.jcr.name. See validation in Granite UI.
- multipleboolean
Indicates if the user is able to select multiple selections.
-
translateOptionsboolean
- true
trueto translate the options,falseotherwise.
-
orderedboolean
- false
trueto sort the options based on the text,falseotherwise.It is assumed that the options don’t contain option group.
-
emptyOptionboolean
- false
trueto also add an empty option;falseotherwise.Empty option is an option having both value and text equal to empty string.
-
deleteHintboolean
- true
trueto generate the SlingPostServlet @Delete hidden input based on the field name.
The options of the select are specified using ItemDataSource.
Each option has the following structure:
- granite:FormSelectItem
- idstring
The id attribute.
- relstring
The class attribute. This is used to indicate the semantic relationship of the component similar to
relattribute.
- classstring
The class attribute.
- titlestring
- i18n
The title attribute.
- valuestringel
- mandatory
The value of the option.
- disabledboolean
Indicates if the option is in disabled state.
- selectedboolean
trueto pre-select this option,falseotherwise.
- textstring
- i18n
The text of the option.
Example:
+ myselect - sling:resourceType = "granite/ui/components/foundation/form/select" - emptyText = "Select" - name = "myselect" + items + option1 - text = "op1" + option2 - text = "op2"
-
granite:FormSelect