-
Notifications
You must be signed in to change notification settings - Fork 42
MMT-4038: Fix issue where one input was affecting another on the form #1423
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
Changes from 8 commits
5e305d5
02b06c2
d2bb7ad
bd0a024
66068af
9a6c769
ef168a4
eb65bda
745d5b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,9 +69,8 @@ const CustomRadioWidget = ({ | |
|
|
||
| // Sets inputValue to input selected | ||
| const handleChange = (event) => { | ||
| const { name } = event.target | ||
| const newValue = name === 'true' | ||
|
|
||
| const { id: targetId } = event.target | ||
| const newValue = targetId.endsWith('-true') | ||
| onChange(newValue) | ||
| } | ||
|
|
||
|
|
@@ -100,7 +99,7 @@ const CustomRadioWidget = ({ | |
| <input | ||
| className="d-flex form-check-input m-2" | ||
| id={`${id}-true`} | ||
| name="true" | ||
| name={`${id}-true`} | ||
|
||
| onChange={handleChange} | ||
| type="radio" | ||
| checked={value === true} | ||
|
|
@@ -115,7 +114,7 @@ const CustomRadioWidget = ({ | |
| <input | ||
| className="form-check-input m-2" | ||
| id={`${id}-false`} | ||
| name="false" | ||
| name={`${id}-false`} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to tack on -false to make it unique. |
||
| onChange={handleChange} | ||
| type="radio" | ||
| checked={value === false} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the id values duplicates? I'm kind of confused why the name would be used here or contain the id value since the name should be what is on the view/display. If its on the same widget since that's the prop coming from the parent maybe we can append another part to the id value in each of the inputs or pass down a little more information where this gets rendered from
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Afaik this is being required by react-json-schema form, otherwise the form itself gets out of sync with the json data.