New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue: disabled property in useForm applied to Form Provider does not apply to all radio inputs #11842
Closed
1 task done
Labels
bug
Something isn't working
Comments
@singhshemona BTW, there is no way to pass |
bluebill1049
added a commit
that referenced
this issue
May 18, 2024
…11873) * feat: allow `iterateFieldsByAction` to iterate over multiple refs * fix: `_disableForm` only disables one input when inputs share a name * test: add unit tests for action iteration over multiple refs * refactor: invert `abortEarly` param's logic to respect semantic meaning * refactor: move ref iteration logic to if block * chore: fix lint errors * test: rename tests to reflect changes * Update createFormControl.ts * Update iterateFieldsByAction.ts * Update iterateFieldsByAction.test.ts --------- Co-authored-by: Beier (Bill) <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version Number
7.51.3
Codesandbox/Expo snack
Link to Codesandbox
Steps to reproduce
Expected behaviour
Both radio inputs should be disabled.
From my understanding, this is happening because both radio inputs are registered with the same name so it only applies the disabled validation to the first one occurring with that name. However, grouped radio inputs are supposed to share the same name and it's their id that differentiates them.
This is my workaround for now:
I've also tried the following:
disabled
property fromuseFormState
But neither worked. Might there be a better or suggested way for radio inputs to pick up on the whole form being set to disabled? I'd like to avoid having to pass down the
canEdit
prop all the way to the radio inputs, especially because I thought the purpose of setting the disabled state in theFormProvider
was so that all the inputs could pick up on it and there would be no prop drilling needed.What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: