By: Eric Cressey
As you create forms in Laserfiche Forms, you’ll often use single line fields to capture information like the user’s name, Social Security number, phone number, and more. This information often has formatting requirements that users must conform to.
You can use regular expressions to ensure users fill these fields with properly formatted values. For example, the regular expression you’d use for a Social Security number’s XXX-XX-XXXX format is:
A single line field using this regular expression would only accept values in this format.
By themselves, regular expressions do not offer insight into the format the field requires. To inform users of the required formatting, you could use helpful text above the field, but users would still have to manually add the necessary dashes, parenthesis, and other formatting.
Field masks, which apply visible formatting to values as a user enters them, are a way to make entering properly formatted information as easy as possible. If you’ve ever entered your phone number in a field and seen the parenthesis and dashes appear automatically, you’ve seen a field mask at work.
Using regular expressions and field masks makes it easier for your users to enter information and ensures that you will capture data in a consistent format.