switch field
The field can be used as a radio button or to select a single value out of two.
- Keyword
switch.
Options
values Optional
- Type
[any, any]. If this parameter is passed, then the included parameter will correspond tovalues[0]value, and offvalues[1].
Also all parameters common to all FormField. Information about them can be found on this page.
Meaning
If the values parameter was not passed, then the value will be true - enabled, false - disabled. In the case where values is passed, the included value will match values[0], and off the remaining value.
Specification
- The field is available when using
TabandShift + Tab. - Selecting an element is possible by clicking on the element itself.
- The choice is possible by pressing
EnterorSpace. - Blocking fields cancels navigation using
Tab. There is also a change in the style ofswitch. - If the validation fails, the field should change the
switchstyle.
Examples
There are no additional-required parameters for this field, so we need to specify only type and name:
html
<form-field name="hasPhone" type="switch"/><form-field name="hasPhone" type="switch"/>ts
import {FormField} from "jenesius-vue-form";import {FormField} from "jenesius-vue-form";Default field:
This is an administrator
In locked state:
Disabled
Field not validated:
Errored
Seleact this fields
Field with passed values: ['yes', 'no']
With passed values
The current state of the form:
ts
{}{}