Select
A selection from predefined values
Specification
multiple
Type:
Boolean
Default:
False
If
true
, multiple selections are allowed.
sort
Type:
String
Allowed values:
text
ornumber
Items are unsorted by default. However, you can sort them by using this option.
grouped
Type:
Boolean
If
true
, options can be grouped by using grouped options syntax.
options
Available types:
array
An array of options for this Select. Example:
string
Specifies an Options RPC URL, that will be called to retrieve dynamic options for this selection.
object
Allows specifying the detailed configuration of options and nested parameters for this Select field.
Available parameters:
store
array
Specifies options for the select field.
store
string
Specifies an options RPC URL, that will be called to retrieve dynamic options for the select.
label
string
Specifies the name of a property that will be used as the label of an option.
value
string
placeholder
string
Specifies the label which will be shown when no option is selected. Available parameters:
label
(string
) Specifies the label which will be shown when no option is selected.nested
(array
)Specifies an array of nested parameters that are shown when no option is selected.
placeholder
object
Specifies a detailed configuration of a placeholder. Available parameters:
label
(string
) Specifies the label which will be shown when no option is selected.nested
(array
)Specifies an array of nested parameters that are shown when no option is selected.
nested
array
Specifies an array of nested parameters that are shown when an option is selected.
When the select is multiple
, the nested parameters will be generated and displayed for selected options.
nested
string
Specifies an RPC URL, that will be called to retrieve dynamic nested options.
mode
Type:
String
.Accepted values:
edit
orchoose
.Specifies the initial mode of select, when editable is
true
.
validate
Type:
Object
orBoolean
.Specifies parameter validation.
When set to false
, the validation against the provided options gets disabled for manual input.
Available parameters:
maxItems
number
Specifies the maximal count of selected items when multiple
is true
.
minItems
number
Specifies the minimal count of selected items when multiple
is true
.
spec
Type:
Object
.Used for validation is
editable
istrue
. If not specified, the value will be passed as is and no validation is performed.Available parameters:
type
string
Specifies a data type of value from the select, which will be validated.
This is usable for example when your API returns numerical IDs in strings but you want them to be typed as numbers in the output of your module.
dynamic
Type:
Boolean
Default:
False
Defines whether a mapped value in the select should be validated against the option values. If
true
, the value is treated as a dynamic and validation is disabled. The value is set to true automatically if select options are generated using RPC.
mappable
Type:
Boolean or Object
Set to
false
to make field non-mappable.If Object, it specifies the detailed configuration of the mapping toggle.
Available parameters:
help
string
Alternative help text is shown only when the mappable toggle is turned on.
editable (deprecated)
Type:
Boolean or Object
If Boolean and set to
true
, the value of select can be edited (or mapped) manually.If Object, specifies a detailed configuration for editable.
Available parameters:
enabled
boolean
If set to true
, the value of select can be edited (or mapped) manually.
help
string
Alternative help text is shown only when the mappable toggle is turned on.
Examples
Basic Select
A basic select with few options which can't be changed manually.
Select with Grouped Options
By enabling grouped
options, you can sort options into groups.
Multiple Choice
You can turn on multiple choice by setting multiple
to true
.
Multiple Choice with Validation
You can validate the number of selected options by using validate
object.
Mappable Select with Help
You can display a custom help message when the mappable toggle is turned on.
Preselected Value
By setting default
, you can set a preselected value. The value of desired option and default has to match to preselect the correct option properly.
Placeholder
You can choose what to display when no option is selected by specifying a placeholder. Notice that you have to put options inside the store
array to make this work.
Nested Options
To display a set of fields only when an option is selected, you may use nested
options.
Nested Fields for Specific Options
You may want to display certain fields only when a specific option is selected. In this case, you can nest fields under a specific option.
Select Under Select
This is a special case of nested options, which is usable for example for specifying a category and its subcategory.
Mode Edit as default
When your select is editable, you can set the default mode edit
.
Nested RPCs
You can nest RPCs when retrieving nested fields dynamically. The nested RPC will receive id
parameter automatically.
Placeholder Nested Fields (deprecated)
To display some fields only when no option is selected, you can use the placeholder
object.
Editable Select (deprecated)
Since Apps platform version 2, all select have set mappable
(editable) to true
by default.
Last updated