Skip to content

Commit

Permalink
Merge pull request #1396 from lucasnetau/fix_select_userdata
Browse files Browse the repository at this point in the history
Fix loading of checkbox-group user data when default select state set in formData
  • Loading branch information
kevinchappell authored Aug 27, 2023
2 parents 570baa4 + 2d284c9 commit 2a67ce0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/js/control/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ export default class controlSelect extends control {
.val(selectedOptions)
.prop('selected', true)
} else if (this.config.type.endsWith('-group')) {
if (this.config.type === 'checkbox-group') {
//clear all checked elements prior to setting them from userData
this.dom.querySelectorAll('input[type=checkbox]').forEach(input => {
input.removeAttribute('checked')
})
}
this.dom.querySelectorAll('input').forEach(input => {
if (input.classList.contains('other-val')) {
return
Expand Down

0 comments on commit 2a67ce0

Please sign in to comment.