make leading zeros optional, remove 0 prefix

This commit is contained in:
Andrew Croce 2018-09-04 13:05:26 -04:00
parent 16e0f3f175
commit 231b3788de
2 changed files with 3 additions and 3 deletions

View File

@ -113,7 +113,7 @@ class BaseFinancialForm(ValidatedForm):
treasury_code = StringField(
"Program Treasury Code",
description="Program Treasury Code (or Appropriations Code) identifies resource types. <br/> <em>It should be a four digit or six digit number, prefixed by one or more zeros.</em>",
description="Program Treasury Code (or Appropriations Code) identifies resource types. <br/> <em>It should be a four digit or six digit number, optionally prefixed by one or more zeros.</em>",
validators=[Required(), Regexp(TREASURY_CODE_REGEX)]
)

View File

@ -64,10 +64,10 @@ export default {
validationError: 'Please enter a valid PE number. Note that it should be 7 digits followed by 1-3 letters, and should have a zero as the first and third digits.'
},
treasuryCode: {
mask: createNumberMask({ prefix: '0', allowDecimal: false, allowLeadingZeroes: true, includeThousandsSeparator: false }),
mask: createNumberMask({ prefix: '', allowDecimal: false, allowLeadingZeroes: true, includeThousandsSeparator: false }),
match: /^0*([1-9]{4}|[1-9]{6})$/,
unmask: [],
validationError: 'Please enter a valid Program Treasury Code. Note that it should be a four digit or six digit number, prefixed by one or more zeros.'
validationError: 'Please enter a valid Program Treasury Code. Note that it should be a four digit or six digit number, optionally prefixed by one or more zeros.'
},
baCode: {
mask: val => {