react-hook-form: issue: disabled is causing undefined values on Submit with error
Version Number
7.53.2
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/rhf-disabled-not-working-forked-yxhlf8
Steps to reproduce
See the error in code sandbox
Once pressed submit, showSomething value goes undefined.
Also check the consol log, last field if present is also undefined during submission.
In my use case this is causing a lot of issues with advanced forms and does not look nice. Also it does not come back to defaultValue (or set value in that matter).
I want to keep disabled form during submission, maybe there is some better way to do it? For me it only creates a problem when there is API error during submission, on normal query without error it is just fine. I think it dissapears after first error of the try.
The problem did not occur with previous version 7.53.1 which means some change was done in 7.53.2 which changes some stuff around.
Video from my use case: https://github.com/user-attachments/assets/6646d029-9360-4811-a9f9-7f670a110ff8
Expected behaviour
Keep the values
Code of Conduct
- I agree to follow this project’s Code of Conduct
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 17 (6 by maintainers)
I found this in the doc , maybe it can help
Thanks for understanding. Your comments were fine, and I appreciate your patient as well. Often after a long day I am already exhausted, so going through comments could be frustrated and missing points.
We can’t do
diablefor the entire form while submitting. I am trying to follow the standard here, with disabled input which will result inundefined. This would be perhaps something you should do at CSS level.