diff --git a/js/components/multi_checkbox_input.js b/js/components/multi_checkbox_input.js index e548cba2..7c0b822c 100644 --- a/js/components/multi_checkbox_input.js +++ b/js/components/multi_checkbox_input.js @@ -32,15 +32,14 @@ export default { showValid: !showError && !!this.initialValue, validationError: this.initialErrors.join(' '), otherChecked: this.initialValue.includes("other") ? true : this.otherChecked, - otherText: this.initialOtherValue + otherText: this.initialOtherValue, + selections: [] } }, mounted: function () { - for (let child of this.$el.firstChild.lastElementChild.children) { - if (this.initialValue.includes(child.firstChild.value)) { - child.firstChild.checked = true - } + for (let choice of this.initialValue) { + this.selections.push(choice) } }, diff --git a/templates/components/multi_checkbox_input.html b/templates/components/multi_checkbox_input.html index 2ca959fa..a373d53c 100644 --- a/templates/components/multi_checkbox_input.html +++ b/templates/components/multi_checkbox_input.html @@ -3,6 +3,7 @@ {% macro MultiCheckboxInput(field, other_input_field, tooltip, inline=False) -%} {% if choice[0] != 'other' %} - + {% else %} - +