Skip to main content

Select

The select field is used to display a dropdown in the form.

Schema

[
{
"name": "country",
"meta": {
"displayType": "select",
"displayName": "Country",
"placeholder": "Select a country",
"validation": {
"required": true,
"requiredDetail": { "errorMsg": "Country is a required field" }
},
"readOnly": false,
"options": [
{
"value": "india",
"label": "India"
},
{
"value": "usa",
"label": "USA"
}
],
"htmlProps": {
"allowDynamic": true
}
},
"prop": "personalInfo"
}
]

Example


Form Data:
{}

props

meta object

The meta object contains properties that define the display characteristics and behavior of the section.

NameDescriptionType
displayNameThe name to display as the section headerstring
descriptionA description text to display under the headerstring
displayPropsAdditional properties to control display settingsobject
validationValidation rules for the sectionobject
optionsThe options to display in the dropdownarray
dependenciesConditions that must be met for the section to be displayedobject
valueThe default value for the select fieldstring
isDisabledWhether the field is disabledboolean
readOnlyA readonly field is not editable and value cannot be changedboolean
classNameAdditional CSS class names to apply to the sectionstring

Common Validation Properties

FieldDescription
requiredMarks a field as mandatory
patternAdds a pattern validation for the field. For email, pattern is supported by default
patternDetailContains info msg and error msg for pattern validation property
minFor Textbox fields, it is the minimum number of characters required for the field. For number fields, it is the minimum value allowed
maxFor Textbox fields, it is the maximum number of characters allowed. For number fields, it is the maximum value allowed
minDetailContains error and info msg for min validation property
maxDetailContains error and info msg for max validation property
requiredDetailContains info msgs about the required validation property

Example JSON

Select with options

[
{
"name": "country",
"meta": {
"displayName": "Country",
"displayType": "select",
"validation": {
"required": true,
"requiredDetail": { "errorMsg": "Country field is a required field" }
},
"options": [
{
"value": "india",
"label": "India"
},
{
"value": "usa",
"label": "USA"
}
]
},
"prop": ""
}
]

Select with default value

[
{
"name": "country",
"meta": {
"displayType": "select",
"placeholder": "Select a country",
"value": "india",
"validation": {
"required": true
},
"options": [
{
"value": "india",
"label": "India"
},
{
"value": "usa",
"label": "USA"
}
]
},
"prop": "personalInfo"
}
]

Select with disabled state

[
{
"name": "country",
"meta": {
"displayName": "Country",
"displayType": "select",
"validation": {
"required": true,
"requiredDetail": { "errorMsg": "Country field is a required field" }
},
"options": [
{
"value": "india",
"label": "India"
},
{
"value": "usa",
"label": "USA"
}
],
"isDisabled": true
},
"prop": ""
}
]

Select with dependencies

[
{
"name": "country",
"meta": {
"displayName": "Country",
"displayType": "select",
"displayProps": {
"loading": true
},
"validation": {
"required": true,
"requiredDetail": { "errorMsg": "Country field is a required field" }
},
"options": [
{
"value": "india",
"label": "India"
},
{
"value": "usa",
"label": "USA"
}
],
"dependencies": {
"conditions": [
{
"field": "name",
"operator": "NOT_EMPTY"
}
]
}
},
"prop": ""
}
]

Select with loading state

[
{
"name": "country",
"meta": {
"displayName": "Country",
"displayType": "select",
"displayProps": {
"loading": true
},
"validation": {
"required": true,
"requiredDetail": { "errorMsg": "Country field is a required field" }
},
"options": [
{
"value": "india",
"label": "India"
},
{
"value": "usa",
"label": "USA"
}
]
},
"prop": ""
}
]