Skip to content

Latest commit

 

History

History
31 lines (28 loc) · 972 Bytes

OnValidate.md

File metadata and controls

31 lines (28 loc) · 972 Bytes

<OnValidate /> Component

This component is responsible for handling validation result for specific inputs. It requires context which is provided by <Form />.

Usage

<Form {...FormProps}>
    <OnValidate 
        groups={["phone", "email"]}
        onValidate={(isAllValid: boolean) => isAllValid ? console.log("Group is valid") : console.log("Group is invalid")}
    >
        <FormGroup name="phone" {...FormGroupProps}>
            // ...
        </FormGroup>
        <FormGroup name="email" {...FormGroupProps}>
            // ...
        </FormGroup>
        <FormGroup name="name" {...FormGroupProps}>
            // ...
        </FormGroup>
    </OnValidate>
     <FormGroup name="middleName" {...FormGroupProps}>
        // ...
    </FormGroup>
</Form>

where:

  • groups - list of inputs name, that are in validation group. Required.
  • onValidate - callback, that triggered on validation. Required.