Skip to content

Multi step forms with ZOD #6264

Answered by yverby
janrembold asked this question in Q&A
May 21, 2024 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

There is another idea to try to validate the fields of a specific step using form.validateField

const hasErrors = ['first', 'second'].some((field) => form.validateField(field).hasError);

if (!hasErrors) {
  // change the current step
}

In this case, you will have one scheme for validation, but during validation, only certain fields will be checked at each step

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@janrembold
Comment options

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