FormOptions

Type that defines the options of a form.

Definition

  • FormOptions object
    • initialValues PartialValues<FieldValues>
    • validate Maybe<ValidateForm>
    • validateOn 'touched' | 'input' | 'change' | 'blur' | 'submit' = 'submit'
    • revalidateOn 'touched' | 'input' | 'change' | 'blur' | 'submit' = 'input'

Explanation

With validateOn and revalidateOn you can define your validation strategy. validateOn defines the time of the first validation and revalidateOn defines when the validation is performed again. If you set validateOn to 'submit', you set the validation strategy at the form level. In this case revalidateOn is applied whenever the form has already been submitted once. For all other values it refers to a single field. In this case revalidateOn is applied if an error has already occurred.