Skip to content

It is not possible to access the list of errors on submit without explicitly calling the trigger method before submission. #10577

Answered by leapful
Ploppy3 asked this question in Q&A
Discussion options

You must be logged in to vote

@Ploppy3

You can get list error by using onError callback of handleSubmit method.

For example:

const { handleSubmit } = useForm();

const onError = (errors) => {

}

const onSubmit = handleSubmit(onValid, onError);

return <form onSubmit={onSubmit}>
...
</form>

Reference: https://react-hook-form.com/docs/useform/handlesubmit

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by leapful
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 #10575 on June 22, 2023 21:45.