display valid state for option inputs that have an initial value
This commit is contained in:
parent
89e613d445
commit
d12bed4ef3
@ -7,13 +7,14 @@ export default {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
initialValue: String,
|
||||
},
|
||||
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
showError: (this.initialErrors && this.initialErrors.length) || false,
|
||||
showValid: false,
|
||||
showValid: !!this.initialValue,
|
||||
validationError: this.initialErrors.join(' ')
|
||||
}
|
||||
},
|
||||
|
@ -6,6 +6,7 @@
|
||||
name='{{ field.name }}'
|
||||
inline-template
|
||||
{% if field.errors %}v-bind:initial-errors='{{ field.errors | list }}'{% endif %}
|
||||
{% if field.data and field.data != "None" %}v-bind:initial-value="'{{ field.data }}'"{% endif %}
|
||||
key='{{ field.name }}'>
|
||||
<div
|
||||
v-bind:class="['usa-input', { 'usa-input--error': showError, 'usa-input--success': showValid }]">
|
||||
|
Loading…
x
Reference in New Issue
Block a user