Fix off by one error

This commit is contained in:
Montana 2019-01-09 10:19:27 -05:00
parent cef8861ab9
commit dd33a23c47
2 changed files with 2 additions and 7 deletions

View File

@ -31,7 +31,7 @@ export default {
validationError: this.initialErrors.join(' '),
otherChecked: this.initialValue.includes("other") ? true : this.otherChecked,
otherText: this.initialOtherValue,
selections: this.setSelection()
selections: this.initialValue
}
},
@ -48,10 +48,5 @@ export default {
this.otherChecked = !this.otherChecked
this.otherText = ''
},
setSelection: function () {
for (let choice of this.initialValue) {
this.selections.push(choice)
}
}
}
}

View File

@ -33,7 +33,7 @@
<li>
{% if choice[0] != 'other' %}
<input type='checkbox' name='{{ field.name }}' id='{{ field.name }}-{{ field.choices.index(choice) }}' value='{{ choice[0] }}' v-model="selections"/>
<label for='{{ field.name }}-{{ loop.index }}'>{{ choice[1] }}</label>
<label for='{{ field.name }}-{{ loop.index0 }}'>{{ choice[1] }}</label>
{% else %}
<input @click="otherToggle" type='checkbox' name='{{ field.name }}' id='{{ field.name }}-{{ field.choices.index(choice) }}' value='other' v-model="selections"/>
<label for='{{ field.name }}-{{ field.choices.index(choice) }}'>{{ choice[1] }}</label>