Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Numeric field validation - zeros

Avatar

Former Community Member

I'm building a form that has a numeric field for bank account numbers.  Can someone help me as to what is the pattern I need to use to handle multiple zeros at the beginning of a value?  I know I can handle one zero at the start by using "num{999999999}", but I am aware of at least one client that has a bank account number that starts with 4 zeros.

2 Replies

Avatar

Level 4

The lowercase z is the value for 0 and then as you know 9 is the value for a digit. So if you have something with 4 zeros you could do something like zzzz999999. So when the user types in 000012345 the 4 zeros will stay put.

Avatar

Level 6

Another option is to deal with the account number as a string (text) rather than a number.  Unless there is actual math that is done with account numbers there is no reason to manipulate them as a number. If they are declared as text then they will be displayed and saved as entered without any change to the format.