Persist text input for the field

This commit is contained in:
Montana 2019-01-04 09:57:23 -05:00
parent c5007d9edb
commit 62ac2642ae
3 changed files with 7 additions and 5 deletions

View File

@ -20,7 +20,8 @@ export default {
initialValue: { initialValue: {
type: Array, type: Array,
default: () => [] default: () => []
} },
initialOtherValue: String,
}, },

View File

@ -1,12 +1,13 @@
{% from "components/icon.html" import Icon %} {% from "components/icon.html" import Icon %}
{% from "components/tooltip.html" import Tooltip %} {% from "components/tooltip.html" import Tooltip %}
{% macro MultiCheckboxInput(field, tooltip, inline=False) -%} {% macro MultiCheckboxInput(field, other_input_field, tooltip, inline=False) -%}
<multicheckboxinput <multicheckboxinput
name='{{ field.name }}' name='{{ field.name }}'
inline-template inline-template
{% if field.errors %}v-bind:initial-errors='{{ field.errors | list }}'{% endif %} {% 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 %} {% if field.data and field.data != "None" %}v-bind:initial-value="{{ field.data }}"{% endif %}
{% if other_input_field.data and other_input_field.data != "None" %}v-bind:initial-other-value="{{ other_input_field.data }}"{% endif %}
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 }]">
@ -37,7 +38,7 @@
<label for='{{ field.name }}-{{ field.choices.index(choice) }}'>{{ choice[1] }}</label> <label for='{{ field.name }}-{{ field.choices.index(choice) }}'>{{ choice[1] }}</label>
<div v-show="otherChecked"> <div v-show="otherChecked">
<input type='text' name='{{ field.name}}_other' id='{{ field.name }}-other' aria-expanded='false'/> <input type='text' name='{{ field.name}}_other' id='{{ field.name }}-other' value="{{ other_input_field.data }}" aria-expanded='false' />
</div> </div>
{% endif %} {% endif %}
</li> </li>

View File

@ -29,12 +29,12 @@
<h3>About Your Project</h3> <h3>About Your Project</h3>
{{ OptionsInput(form.app_migration) }} {{ OptionsInput(form.app_migration) }}
{{ OptionsInput(form.native_apps) }} {{ OptionsInput(form.native_apps) }}
{{ MultiCheckboxInput(form.complexity) }} {{ MultiCheckboxInput(form.complexity, form.complexity_other) }}
<hr> <hr>
<h3>About Your Team</h3> <h3>About Your Team</h3>
{{ MultiCheckboxInput(form.dev_team) }} {{ MultiCheckboxInput(form.dev_team, form.dev_team_other) }}
{{ TextInput(form.dev_team_other) }} {{ TextInput(form.dev_team_other) }}
{{ OptionsInput(form.team_experience) }} {{ OptionsInput(form.team_experience) }}