Add validation

This commit is contained in:
leigh-mil 2018-10-31 16:51:23 -04:00
parent b13ba188bf
commit 2dd1822cf8
2 changed files with 7 additions and 1 deletions

View File

@ -47,6 +47,12 @@ export default {
unmask: ['(',')','-',' '], unmask: ['(',')','-',' '],
validationError: 'Please enter a 10-digit phone number' validationError: 'Please enter a 10-digit phone number'
}, },
phoneExt: {
mask: [/\w/, /\w/, /\w/, /\w/, /\w/, /\w/, /\w/, /\w/, /\w/, /\w/],
match: /^\w*$/,
unmask: [],
validationError: 'Optional: Please enter up to 10 characters'
},
dodId: { dodId: {
mask: createNumberMask({ prefix: '', allowDecimal: false, includeThousandsSeparator: false }), mask: createNumberMask({ prefix: '', allowDecimal: false, includeThousandsSeparator: false }),
match: /^\d{10}$/, match: /^\d{10}$/,

View File

@ -6,7 +6,7 @@
{{ TextInput(phone_number, placeholder=placeholder_phone, validation='usPhone') }} {{ TextInput(phone_number, placeholder=placeholder_phone, validation='usPhone') }}
</div> </div>
<div class='phone-input__extension'> <div class='phone-input__extension'>
{{ TextInput(phone_ext)}} {{ TextInput(phone_ext, validation='phoneExt')}}
</div> </div>
</div> </div>
{%- endmacro %} {%- endmacro %}