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

FIO-7225: Fixed issues with complex values for Radio component #5936

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

roma-formio
Copy link
Contributor

@roma-formio roma-formio commented Dec 5, 2024

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:

  • I have completed the above PR template
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above

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.

1 participant