Validation Rules 


In this Article
Related Articles

Overview

The purpose of input validation is to help your respondents provide the desired answers in the expected format. It is an aid, and it is not designed to be foolproof. There are ways one can bypass the validation and, although rare in a normal use case, invalid responses should not be unexpected.

Note: It is not suggested to use more than one validation type per field.

All validation rules can be accessed by clicking on a field, selecting Options, and then selecting Validation Rules from the Field Properties menu.

Note:  
  • Validation Rules may not work as expected on the form if JavaScript is disabled on the respondent's web browser.
  • Validation Rules are not available for the Question type: Hidden Field. Instead, set the question type to "text input", and edit the field Options for Access Control to "Hidden".

Limit Length of Input

This option allows you to set the maximum number of characters or words to be allowed in a text field and text area. You can only define a limit for characters or words and not for both.


Required Fields

Users can be required to fill out a given field before submitting or proceeding to a form's next page.

To set a field as required:

  1. Select your question and click the Options button to open the Field Properties menu.  
  2. Select Validation Rules.
  3. Check the corresponding box for "This is a required field".

This can also be accomplished by clicking the Req'd button after clicking on a field in your form.

Note:  If Page Navigation is enabled on a multi-page form, a respondent will be notified of any required fields left blank through the form when they try to submit the form.

Require an Email Address

To require a valid email address:

  1. Select a text input question and click the Options button to open the Field Properties menu.
  2. Select Validation Rules.
  3. In the Expected Input Format menu, select Email.
Note:  FormAssembly's email validation will allow an underscore in a domain of an email to pass validation settings on a form, but Salesforce will not accept an underscore in the domain of an email.
Note:  FormAssembly's email validation will allow multiple email addresses separated by commas, but Salesforce will throw an error if it is pushed to Salesforce. Salesforce expects only one email address per email field.

Require Numbers Only

To require numbers only:

  1. Select a text input question and click the Options button to open the Field Properties menu. 
  2. Select Validation Rules.
  3. In the Expected Input Format menu, select Number [0-9].

Require a Number Within a Range

Numbers can be limited within a range by doing the following:

  1. Select a text input question and click the Options button to open the Field Properties menu.
  2. Select Validation Rules.
  3. In the Expected Input Format menu, select Number [0-9].
  4. Enter the lower number in the From field and the higher number in the To field.

Require a Date and/or Time

To require a field to accept only a date:

  1. Select a text input field and click the Options button to open the Field Properties menu.
  2. Select Validation Rules.
  3. In the Expected Input Format menu, select Date, Time, or Date and Time.

Select the Date (with calendar) option if you'd like to allow respondents to use a calendar to select the date.


Require a Date and/or Time Within a Range

Date inputs can be limited to a specific date range. To enter your range:

  1. Select a text input field and click the Options button to open the Field Properties menu.
  2. Select Validation Rules.
  3. In the Expected Input Format menu, select Date, Time, or Date and Time.
  4. Enter your beginning date in the From field and your ending date in the To field.

Require a Custom Format

Create your own formatting rules by using regular expressions, creating an automatic format, or limiting the number of characters that can be entered into a field.

  1. Select your question and click the Options button to open the Field Properties menu.
  2. Select Validation Rules.
  3. In the Expected Input Format menu, select Custom...
  4. Create your rules in the corresponding fields.


Auto-Format with a Mask

Auto-formatting can be used for simple patterns, such as a phone number or serial number.

For instance, let's say you have a serial number field, and all of the serial numbers expected to be entered on your form start with "M4K", then have 4 numbers and 2 letters. The mask would be M4K####$$, with # = numbers and $ = alphanumeric characters (letters or numbers).

Characters like commas, slashes, and dashes will all act like M4K and only function as placeholders. The expected format will be visible once the field is selected.

Note: The Auto-Format with a Mask feature does not work reliably on Android phones. The best alternative would be to use a regular expression instead. 

Validate with a Regular Expression

Note:  Expressions must be enclosed in "/".  For example:
  • This works:  /[\d]3/g/
  • This doesn't:  [\d]3/g

Regular expressions can help you define an expected pattern. Crafting regular expressions can be difficult. It is usually best to copy & paste an existing expression than try to come up with your own. 

While we'd like to provide as much support as we can, we are unable to support expressions as they can break in ways we cannot predict such as when updates are made. 

Please reference the links below for information and assistance on expressions:

Terms of Service · Privacy Policy