Use hidden input to track environment names

Since we're using ally.js for modals, when the modal is open, other
elements are disabled. Since the form is submitted when the "Create"
button is clicked and browsers do not submit disabled form fields, the
form was not submitting environment names when creating a project.

This workaround creates hidden inputs to track the environment names.
Since they're hidden, they are not disabled by ally.js, so the fields
are properly submitted.

This should be the only form affected, since this is the only form
submitted via a modal button.
This commit is contained in:
Patrick Smith 2018-10-24 16:37:19 -04:00
parent 778c029877
commit 880d40d5ec

View File

@ -57,7 +57,8 @@
<li v-for="(environment, i) in environments" class="block-list__item project-edit__env-list-item"> <li v-for="(environment, i) in environments" class="block-list__item project-edit__env-list-item">
<div class="usa-input"> <div class="usa-input">
<label :for="'environment_names-' + i">Environment Name</label> <label :for="'environment_names-' + i">Environment Name</label>
<input type="text" :name="'environment_names-' + i" :id="'environment_names-' + i" v-model="environment.name" placeholder="e.g. Development, Staging, Production"> <input type="text" :id="'environment_names-' + i" v-model="environment.name" placeholder="e.g. Development, Staging, Production"/>
<input type="hidden" :name="'environment_names-' + i" v-model="environment.name"/>
</div> </div>
<button v-on:click="removeEnvironment(i)" v-if="environments.length > 1" type="button" class='project-edit__env-list-item__remover'> <button v-on:click="removeEnvironment(i)" v-if="environments.length > 1" type="button" class='project-edit__env-list-item__remover'>
{{ Icon('trash') }} {{ Icon('trash') }}