FIO-7225: Fixed issues with complex values for Radio component #5936
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.
Link to Jira Ticket
https://formio.atlassian.net/browse/FIO-7225
Description
Issue: Using the radio component with a URL data source and complex data types (such as objects or arrays) as values can lead to incorrect behavior and visual bugs, such as missing labels in submissions. The problem arises because the radio component should use string values in HTML, and the current implementation uses
toString
to convert values to strings, which can result in the string representation[object Object]
, making it difficult to track the original value.Solution: If the value type differs from a string, create a values mapping (unique generated string -> original value) and use the unique generated string for the value of the HTML radio input. Any further updates from HTML or programmatically will involve checking the values mapping and restoring original values if necessary. This approach allows the radio component to handle any complex value structure and ensures that the original values are preserved and correctly mapped back when needed.
How has this PR been tested?
Unit testing
Checklist: