Skip to content

Validation Strategies

romagny13 edited this page Jul 8, 2017 · 1 revision

Validation (with ValidationHelper)

Validate all on form Submission:

  • create a state variable submitted (boolean) for example
  • handle onSubmit and set submitted to true on submit
  • check if is submitted onValueChange to validate all or only the form element value
  • check on each form group form is submitted to set canChangeValidationState

... or when a form element is touched, validate all or only the element value

  • create a state variable touched (object with names of form element touched) for example
  • handle onTouch on form element components and set touched with the name passed
  • check all errors or only for the form element onValueChange
  • check on each form group if the form element component is touched to set canChangeValidationState

... other scenarios

Clone this wiki locally