Form Wire
Guides

Validation Timing

Control when validation runs

Form Wire lets you control when field validation fires.

Three Timing Modes

ModeBehavior
onSubmitValidates on form submit only (default)
onBlurValidates when the user leaves a field
onChangeValidates on every keystroke

Setting the Timing

Provider Level (Default)

<FormWireProvider mapper={mapper} validationTiming="onBlur">
  {/* All forms in this tree validate on blur */}
</FormWireProvider>

Form Level (Override)

<Form action={submit} validationTiming="onChange">
  {/* This form validates on change, regardless of provider */}
</Form>

How It Interacts with Async Validation

Validation timing affects both sync (Zod) and async validation:

  • onBlur: Best UX for async validators (e.g., username uniqueness). Fires once when the user tabs away, not on every keystroke.
  • onChange: Immediate feedback but more API calls. Form Wire still protects against stale responses.
  • onSubmit: Only validates when the user clicks Submit. Most efficient, least immediate feedback.
  • Simple forms → onSubmit (default)
  • Forms with async validation → onBlur
  • Real-time feedback needs → onChange

On this page