Skip to main content

sdk.form.toggleschema.validation

Home > @matterway/sdk > Form > ToggleSchema > validation

Form.ToggleSchema.validation property

A list of validation rules for this field.

Signature:

validation?: BooleanValidation;

Remarks

Rules are AND, so all of them must pass, for the field to be valid. Rules are tested in order, until one fails. Fields can only display one error, so earlier rules have priority over later ones. As a guideline, wide, general rules like required should come before narrower, more detailed ones, like pattern.

Example

validation: {type: 'number', rules: [
{type: 'required'},
{type: 'min', params: [0, 'Must be positive']},
]},