Skip to content

Multiple Error messages #1871

Discussion options

You must be logged in to vote

@joshyudeep you can set validateCriteriaMode to all for multiple error messages.

// set validateCriteriaMode to `all`
const { register } = useForm({
  validateCriteriaMode: "firstErrorDetected",
})

{errors.yourInputName?.types && Object.entries(errors.yourInputName?.types).map(([type, message]) => (
  <p key={type}>{message}</p>
))}

please see example here.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@joshyboyrules
Comment options

@bluebill1049
Comment options

@nani1008
Comment options

@joshyboyrules
Comment options

@joaopedrodcf
Comment options

Answer selected by bluebill1049
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