Replies: 6 comments 9 replies
-
To be fair, the
RHF provides a resolver for each validation library, meaning, it's only an adapter / an interface for the library and it doesn't manipulate validation logic. |
Beta Was this translation helpful? Give feedback.
-
Provided, yup mutates it's object, there's a chance we can't do anything with it's validation behavior (might be wrong) |
Beta Was this translation helpful? Give feedback.
-
please use the debug step to verify what data is sent to the hook form for the validation. field array validation on the input itself and after user action at
|
Beta Was this translation helpful? Give feedback.
-
Have you found a solution here? I am running into the same issue using a |
Beta Was this translation helpful? Give feedback.
-
I think the problem has been solve with react-hook-form 7.41.3, you can check it out here: https://codesandbox.io/s/still-leftpad-u3qcbc |
Beta Was this translation helpful? Give feedback.
-
I think the behavior is already described clearly in here: https://react-hook-form.com/api/useform By default, after first form submitting, validation will be triggered on change of each field element. The behavior about global error message is cleared when removing third item related to your validation rules of yup, not from react-hook-form. Like the documentation above, after submitting, validation will be trigged on change of each field but yup by default will stop on validation for case schema has parent - child relation. The validation timeline:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Version Number
7.33.1
Codesandbox/Expo snack
https://codesandbox.io/s/goofy-golick-iigcco?file=/src/App.js
Steps to reproduce
Expected behaviour
When
useForm
is used with modeonSubmit
I would expect no validation errors before the user actually tried to submit the form. From the codesandbox you can see that the use of "test" on the fieldsomeList
is causing an error - even before submitting the form. However, the "test" function used onitem
insomeList
is working as expected, only validating after hitting the submit button.There is also some strange behaviour with how the validation message disappears from
someList
. Adding the required amount of items does not clear the validation error, but adding one more item and then deleting it causes the validation error to disappear.What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions