Add frontend validation for TextInput()s

- Add input validation regexes to input_validations.js
- Add those validators to text fields without validaiton
This commit is contained in:
graham-dds
2020-01-21 10:12:04 -05:00
parent 156d733aee
commit 3cf9fdac76
12 changed files with 46 additions and 17 deletions

View File

@@ -13,7 +13,7 @@
) }}
<div class="accordion-table__item-content new-env">
<div class="h4">{{ "portfolios.applications.enter_env_name" | translate }}</div>
{{ TextInput(new_env_form.name, label="", validation="requiredField", optional=False) }}
{{ TextInput(new_env_form.name, label="", validation="defaultStringField", optional=False) }}
<div class="action-group">
{{ SaveButton(text=('common.save' | translate), element="input", form="add-new-env") }}
<a class='action-group__action icon-link icon-link--default' v-on:click="toggle">

View File

@@ -81,7 +81,7 @@
<base-form inline-template>
<form action="{{ url_for('applications.update_environment', environment_id=env['id']) }}" method="post" v-on:submit="handleSubmit">
{{ edit_form.csrf_token }}
{{ TextInput(edit_form.name, validation='requiredField', optional=False) }}
{{ TextInput(edit_form.name, validation='defaultStringField', optional=False) }}
{{
SaveButton(
text=("common.save_changes" | translate)

View File

@@ -119,8 +119,8 @@
{% macro InfoFields(member_form) %}
<div class="user-info">
{{ TextInput(member_form.first_name, validation='requiredField', optional=False) }}
{{ TextInput(member_form.last_name, validation='requiredField', optional=False) }}
{{ TextInput(member_form.first_name, validation='name', optional=False) }}
{{ TextInput(member_form.last_name, validation='name', optional=False) }}
{{ TextInput(member_form.email, validation='email', optional=False) }}
{{ PhoneInput(member_form.phone_number, member_form.phone_ext)}}
{{ TextInput(member_form.dod_id, validation='dodId', optional=False) }}