Skip to content

Commit

Permalink
fix: use the correct selector for the checkbox-group other value inpu…
Browse files Browse the repository at this point in the history
…t, control may not have been added to the document dom at the time of onRender.

fix: move selectedOptions.length check to the upper if statement
  • Loading branch information
lucasnetau committed Oct 31, 2023
1 parent 477f7ca commit 0768868
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/js/control/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,8 @@ export default class controlSelect extends control {
}

// Did not find a match for the selectedOption, see if this is an "other"
if (input.id.endsWith('-other')) {
const otherVal = document.getElementById(`${input.id}-value`)
// If there is no value to set, don't check the other option
if (selectedOptions.length === 0) {
return
}
if (input.id.endsWith('-other') && selectedOptions.length > 0) {
const otherVal = this.dom.querySelector(`#${input.id}-value`)

// set the other value
input.setAttribute('checked', 'checked')
Expand Down

0 comments on commit 0768868

Please sign in to comment.