Skip to content

Soft validation #4465

Closed Answered by logaretm
martijndewit asked this question in Q&A
Discussion options

You must be logged in to vote

Moved to discussions since its more of a question.

You have a few options, since your rules do not block the submission using optional or nullable with yup or zod should do the trick. If you are using global rules then you can do the following:

You could use validate instead of using handleSubmit.

const { validate, values } = useForm();
async function onSubmit() {
  // if you are interested in validating
  const result = await validate();

  // submit your data
  sendToApi(values);

  // do what you want next
  step.value++;
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by martijndewit
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #4462 on September 07, 2023 08:55.