FIO-5687: Fix: Support multiple values in Select component setValue/updateValue in HTML 5 mode #6252
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-5687
Description
What changed?
The select component, with HTML 5 as the display type, did not support multiple values when that option was selected.
This PR updates the setValue() and updateValue() logic in the Select component to correctly handle multiple values and improve event handling in HTML5 mode.
Fixes #5572.
Why have you chosen this solution?
The conditions were added to ensure that the values are stored in an array if the multiple values option is selected in HTML 5 mode, while minimizing the impact this could have on the existing logic also shared when in ChoicesJS mode.
Breaking Changes / Backwards Compatibility
I do not believe this code can potentially break changes or have any adverse effects on backwards compatibility.
Dependencies
There are no dependent changes/PRs in other Form.io modules.
How has this PR been tested?
This was tested locally, with different select component settings: