Text field validation
Availability: Essentials, Business, and Enterprise plans
With this feature, we’ll help you make sure your recipients’ input information in fields always appears in the correct format.
Note:
You can set field validation only in text fields.You can set these field formats in a text field:
- Email address
- Phone number
- ZIP Code
- Social Security number
- Numbers-only
- Letters-only
- Custom rule (regular expression)
To enable one of these formats in a text field, first, add a text field to your document or template. Then, click on the field properties icon and go to the setting on the right panel. Under Validation, select one of the formats.
If information appears in a field in an incorrect format, and the document is still in draft status, the document can’t be sent until the format has been corrected.
If the recipient has entered invalid information, they won’t be able to finish the document. Any fields with invalid inputs will be indicated.
Custom rule (regular expression)
Note:
We’re gradually releasing this feature to our customers, so you might not see it within your account right away.You can use custom rules to create validation patterns via regular expressions (regex).
Regular expressions provide a powerful tool for validating text fields. By defining patterns, you can enforce specific rules and restrictions on recipients’ input.
To create a custom rule, determine the specific requirements for your text field validation. For example, you might want to validate that the input contains only letters, numbers, or a specific set of characters. Identify any length restrictions or specific patterns you want to enforce.
Based on your requirements, create the regular expression pattern that matches the desired input. For example, if you want to validate that the input consists of letters and numbers, the pattern could be [A-Za-z0-9]+.
Follow these steps to enable custom validation for a text field:
- Add a text field in a document, template, content library item, or form
- Select Properties on the floating panel and select Custom rule (regular expression) in the Validation dropdown
- In the Custom rule pattern field, enter the regular expression that defines the data format you want your recipient to input
- In the Recipient instructions field, provide details that help your recipients to enter the correct information
- Enable the Required setting and send the document
Once you send your document, the recipient will be able to finalize it only if they enter valid information. If they provide information in an incorrect format the field will be highlighted in red.
Regular expressions can be complex, and their implementation might require knowledge of specific regex features and options. Learn more about regular expressions here.
Examples of regex validation patterns
Here are several examples of regex validation patterns:
Canadian Social Insurance Number (SIN)
- Pattern: ^\d{3}(\s?|[-]?)\d{3}(\s?|[-]?)\d{3}$
- Description: Validates Canadian Social Insurance Number. Accepted values are 123123123, 123 123 123 or 123-123-123.
Credit Card Number
- Pattern: ^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|6(?:011|5[0-9]{2})[0-9]{12}(?:2131|1800|35\d{3})\d{11})$
- Description: Validates Credit Card Numbers of different types. Supports Visa, MasterCard, American Express, Diners Club, Discover, and JCB cards.
US State Abbreviations
- Pattern: (A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])
- Description: Validates US state postal abbreviations (two letters, always capitalized without any periods).
UK National Insurance Number (NINo)
- Pattern: [A-CEGHJ-PR-TW-Z]{1}[A-CEGHJ-NPR-TW-Z]{1}\s?[0-9]{2}\s?[0-9]{2}\s?[0-9]{2}\s?[A-DFMP ]
- Description: Validates UK National Insurance Number. A NINO is made up of 2 letters, 6 numbers and a final letter, which is always A, B, C, or D. It looks something like this: QQ 12 34 56 A.
International Bank Account Number (IBAN)
- Pattern: ^[A-Z]{2}[0-9]{2}[A-Z0-9]{1,30}$
- Description: Validates International Bank Account Number (IBAN), which is a standardized format used by most European countries. The format consists of letters and numbers and has a fixed length of up to 34 characters.