Select
The "select" element is used to create a drop-down list. This element is most often used in a form to collect user input.
Example
API Methods
setData
Sets the data in the particular array of objects.
- Method
- Usage
setData(data: SelectData[]): void
a8forms.Select("<selectId>").setData([
{
label: "Yes",
value: "yes",
id: 123,
},
{
label: "No",
value: "no",
id: 123,
},
]);
setLabel
Sets the label of the checkbox.
- Method
- Usage
setLabel(label: string): void
// Sets the field's label to 'Weather Report'
a8forms.Select("selectId").setLabel("Weather Report")
setPlaceholder
The placeholder attribute specifies a short hint that describes the expected value of a text field.
- Method
- Usage
setPlaceholder(placeholder: string): void
// Sets the placeholder as Email in a text field
a8forms.Select("selectId").setPlaceholder("Email")
setReadOnly
Sets the ReadOnly flag for this context. When in ReadOnly the user cannot be able to edit the content.
- Method
- Usage
setReadOnly(readOnly: boolean): void
//sets the field to ReadOnly not editable by the user
a8forms.Select("selectId").setReadOnly(true)
// Sets the field to be active, editable by the user
a8forms.Select("selectId").setReadOnly(false)
setRequired
Sets a field to be required or not.
- Method
- Usage
setRequired(required: boolean): void
// Sets the field as required
a8forms.Select("selectId").setRequired(true)
// Sets the field as not required
a8forms.Select("selectId").setRequired(false)
setSize
Sets the size only using the parameters passed in.
- Method
- Usage
setSize(size: "small" | "medium" | "large"): void
//Sets the size to small
a8forms.Select("selectId").setSize("small")
//Sets the size to medium
a8forms.Select("selectId").setSize("medium")
//Sets the size to large
a8forms.Select("selectId").setSize("large")
setVisibility
Sets the elements of the given category to visible in this view.
- Method
- Usage
setVisibility(visible: boolean): void
// setting the visibility true makes the element to visible
a8forms.Select("selectId").setVisibility(true)
// setting the visibility false makes the element to not visible
a8forms.Select("selectId").setVisibility(false)
setVisibilityCondition
Sets the hide condition
- Method
- Usage
setVisibilityCondition(condition: string): void
// Hides the string
a8forms.Select("selectId").setVisibilityCondition("1 == 1");