Add validator to user form for consistent validation

This commit is contained in:
leigh-mil 2018-11-28 15:17:59 -05:00
parent 923313dafa
commit cdcc954cf6
2 changed files with 8 additions and 2 deletions

View File

@ -9,6 +9,12 @@ export default {
unmask: [],
validationError: 'Please enter a response'
},
requiredField: {
mask: false,
match: /.+/,
unmask: [],
validationError: 'This field is required'
},
integer: {
mask: createNumberMask({ prefix: '', allowDecimal: false }),
match: /^[1-9]\d*$/,

View File

@ -9,11 +9,11 @@
<div class='panel__content'>
<div class='form-row'>
<div class='form-col form-col--half'>
{{ TextInput(form.first_name) }}
{{ TextInput(form.first_name, validation='requiredField') }}
</div>
<div class='form-col form-col--half'>
{{ TextInput(form.last_name) }}
{{ TextInput(form.last_name, validation='requiredField') }}
</div>
</div>