Skip to content
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

Fix isFormControl to check if form attribute is defined (checkbox, radio-group, select, slider, switch) #2668

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

seanlennaerts
Copy link

Description

In some situations it is useful to render form inputs outside of a form. Inputs have a form attribute where you can specify which form the input is associated with. This PR fixes the isFormControl check to not only check if the input is contained in a form but to also check if the form attribute has been specified. It also passes the form attribute to the hidden input so that it will be submitted correctly.

Fixes #2530

@seanlennaerts seanlennaerts changed the title Fix isFormControl check to include presence of form attribute (checkbox, radio-group, select, slider, switch) Fix isFormControl to check if form attribute is defined (checkbox, radio-group, select, slider, switch) Jan 26, 2024
@seanlennaerts
Copy link
Author

Hey @benoitgrelard / @andy-hook any updates here? Let me know what I can do to get this PR over the line. If there are plans to merge this then I can fix the conflicts.

@nicolastoulemont
Copy link

nicolastoulemont commented Mar 18, 2024

Facing the same issue in my remix apps.
Indeed, Remix heavily encourages uncontrolled components and form-based mutation/query, and using form IDs is a quite common way to solve the layout challenges that complex UI raises.

So far, this lack of support for the form prop and the way the isFormControl is resolved is preventing me from using these components in anything other than basic forms.

Happy to do whatever is needed to help this PR get merged & released

@DarkPurple141
Copy link

Hi folks thought I'd chime in on this one as this would be a welcome change - let us know if more discussion desired to make this work or help wanted 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Checkbox and other components do not render <input> element with form attribute
3 participants