validate

Validates the entire form, several fields and field arrays or a single field or field array.

// Validate the entire form
validate(form, options);

// Validate a single field or field array
validate(form, name, options);

// Validate several fields and field arrays
validate(form, names, options);

Parameters

  • form FormStore
  • name string
  • names string[]
  • options object = {}
    • shouldActive boolean = true
    • shouldFocus boolean = true

Explanation

In addition to the names of the fields, you can also specify the name of a field array under names or name. In this case, the field array and the fields and field arrays it contains will be validated.

By default, only the active fields are validated and the first field where an error occurs during the validation is focused. To change this behavior you can set shouldActive and/or shouldFocus to false.