You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Notice the correct errors show up, one for text input and one for textarea
Click on submit for the Validation For First Element Only Working Form
Notice the error only show up first text input field
Expected behaviour
Not sure if it is expected or not, but its an easy trap to fall into. IMO isSubmitting should be true after validation. If this is as expected, a note about this in docs, or a new state that can be used to safely unmount the form during asynchronous operations would be helpful.
Using isValid && isSubmitting together seems to do the trick.
What browsers are you seeing the problem on?
No response
Relevant log output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
did you see the codesandbox and see that validation is not working as expected in the second form? i.e. validation is only being applied to the first input in the second form, when it should validate all fields.
This happens when the form is unmounted when isSubmitting is set to true. If this is expected then nothing needs to be fixed.
did you see the codesandbox and see that validation is not working as expected in the second form? i.e. validation is only being applied to the first input in the second form, when it should validate all fields.
it wouldn't, rhf focus on single field validation at a time by design. if you need multiple use trigger
It's okay if RHF only validates one field at a time, however in this case, it only ever validates the first field. If you enter a value in the first field in the second form, it does not actually validate anything. You can see the image below.
Version Number
7.51.3
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/react-hook-form-7-51-3-validation-bug-z7yz34?file=%2Fsrc%2Fvalidation-not-working.js
Steps to reproduce
Expected behaviour
Not sure if it is expected or not, but its an easy trap to fall into. IMO isSubmitting should be true after validation. If this is as expected, a note about this in docs, or a new state that can be used to safely unmount the form during asynchronous operations would be helpful.
Using isValid && isSubmitting together seems to do the trick.
What browsers are you seeing the problem on?
No response
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: