Update valid prop on MultiCheckboxInput to return true if the field is optional

This commit is contained in:
leigh-mil 2019-11-22 09:33:39 -05:00
parent 62cdcbe6dc
commit 20a2abd36b
2 changed files with 3 additions and 1 deletions

View File

@ -14,6 +14,7 @@ export default {
default: () => [], default: () => [],
}, },
initialOtherValue: String, initialOtherValue: String,
optional: Boolean,
}, },
data: function() { data: function() {
@ -45,7 +46,7 @@ export default {
computed: { computed: {
valid: function() { valid: function() {
return this.showValid return this.optional || this.showValid
}, },
}, },
} }

View File

@ -11,6 +11,7 @@
{% if other_input_field and other_input_field.data and other_input_field.data != "None" %} {% if other_input_field and other_input_field.data and other_input_field.data != "None" %}
initial-other-value="{{ other_input_field.data }}" initial-other-value="{{ other_input_field.data }}"
{% endif %} {% endif %}
v-bind:optional={{ optional|lower }}
key='{{ field.name }}'> key='{{ field.name }}'>
<div <div
v-bind:class="['usa-input', { 'usa-input--error': showError, 'usa-input--success': showValid }]"> v-bind:class="['usa-input', { 'usa-input--error': showError, 'usa-input--success': showValid }]">