select
This is a HTML select & option selection list field. You can only select one item.

Special properties of field

Property
Default
Accepted values
Description
values
none
Array or Function
List of items. It can be an array with items, or a Function, what is resulted an array. The item will be a String or an object with an id and a name properties.
selectOptions
{}
Object
Settings to select component. See details below.

selectOptions

Property
Default
Accepted values
Description
noneSelectedText
<Nothing selected>
String
Change the text for the no selection option.
hideNoneSelectedText
false
Boolean
Hide the noneSelected item
value
id
String
Used to select any properties from object in values to use as actual value to save in model.
name
name
String
Used to select any properties from object in name to use as display in the list

Usage

Select field with array of strings:

1
{
2
type: "select",
3
label: "Type",
4
model: "type",
5
values: [
6
"Personal",
7
"Business"
8
]
9
}
Copied!
If you select the first item, the value will be "Personal" in the model.

Select field with object items:

1
{
2
type: "select",
3
label: "Language",
4
model: "lang",
5
required: true,
6
values: function() {
7
return [
8
{ id: "en-GB", name: "English (GB)" },
9
{ id: "en-US", name: "English (US)" },
10
{ id: "de", name: "German" },
11
{ id: "it", name: "Italic" },
12
{ id: "fr", name: "French" }
13
]
14
},
15
default: "en-US",
16
validator: validators.required
17
}
Copied!
If you select the second item, the value will be "en-US" in the model.

Creating an <optgroup> with Select field:

1
{
2
type: "select",
3
label: "Choose the fastest",
4
model: "the-fastest",
5
required: true,
6
values: [
7
{ name: "Marc Marquez", id: "93", group: "MotoGP" },
8
{ name: "Valentino Rossi", id: "46", group: "MotoGP" },
9
{ name: "Lewis Hamilton", id: "44", group: "Formula 1" },
10
{ name: "Sebastian Vettel", id: "5", group: "Formula 1" }
11
],
12
validator: validators.required
13
}
Copied!
Last modified 3yr ago