TanStackT
TanStack2mo ago
3 replies
dual-salmon

Validate onChange only after first submission

I really want to be able to make the onChange validation only calls after the first submission validation goes wrong, cause its kinda weird the user already see errors in the form before even try to submit it.

Something like that:
const formOpts = formOptions({
  defaultValues: {
    email: '',
    password: '',
  },
  validators: {
    onChange:  (ctx) => ctx.formApi.hasSubmitted ? formSchema : undefined,
  },
})


But i did not found something similar, any sugestions?
Was this page helpful?