Skip to content
Discussion options

You must be logged in to vote

Is this something similar to what you're looking for?

const form = useForm({
  validators: {
    onChange: ({ formApi }) =>
      formApi.state.submissionAttempts > 0 ? yourValidator : undefined,
    onSubmit: ({ formApi }) => formApi.state.submissionAttempts == 0 ? yourValidator : undefined
  },
});

If you're validating with a schema library like zod or valibot, you can use formApi.parseValuesWithSchema(yourSchema) as yourValidator in the snippet above

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
3 replies
@ammarmbe
Comment options

@ammarmbe
Comment options

@Balastrong
Comment options

Answer selected by Balastrong
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@Balastrong
Comment options

@dd-jonas
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants