-
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
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5e305d5
MMT-4083: Increased lengh of pref label and alt label to 1024
02b06c2
MMT-4038: Added missing Aggregation field into UI schema.
d2bb7ad
Merge branch 'main' into MMT-4038
bd0a024
MMT-4083: Updated based on PR feedback.
66068af
MMT-4038: Removed redundant Aggregation
9a6c769
MMT-4038: Updated to latest edsc preview.
ef168a4
MMT-4038: Fixed issue when toggling radio button to true/false.
eb65bda
Merge branch 'main' into MMT-4038
745d5b2
MMT-4038: Added comment about name properties needing to be unique
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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`} // Note: react-jsonschema-form requires these name properties to be unique. | ||
| onChange={handleChange} | ||
| type="radio" | ||
| checked={value === true} | ||
|
|
@@ -114,8 +113,8 @@ const CustomRadioWidget = ({ | |
| > | ||
| <input | ||
| className="form-check-input m-2" | ||
| id={`${id}-false`} | ||
| name="false" | ||
| id={`${id}-false`} // Note: react-jsonschema-form requires these name properties to be unique. | ||
| 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} | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.