Table of Contents

Validation Rules

Danielle Kellogg Updated by Danielle Kellogg

What is a Validation Rule?

Validation rules allow for values which are or are not allowed on a specific field. Validation rules apply when adding or editing a field, both in the Builder and on Live App pages, and appear as a message if the rule has not been met. For example, you can:

  • Limit the number of characters in a paragraph text field
  • Restrict files to specific types and sizes
  • Allow only a specific range of numbers and dates
  • Run your own regular expressions on a Short Text field
  • Set password minimum and maximum character counts on a User Role password field

Manage Validation Rules

Add a Validation Rule

From the "Data" section in the Builder, select the object where the field is located, where you want to add your validation rule. In order to add a validation rule to a field, you'll need to edit that field. To do so, click on the gear icon on the field.

  1. Click on the Validation Rules tab from the Advanced Options modal.
  2. Check the checkbox next to "Add field validation rules" to start adding rules for this field.
  3. Add your When condition: a field on that object, the condition, and the value. Available conditions will depending on the type of the field chosen.
  4. Type the message you want to appear when the condition in the When section is not met.
  5. Click on the "Add Rule" button if you'd like to add additional validation rules for this field. See the section below Multiple Validation Rules for details on more than one validation rule on a field.

The above rule states that When this field's character count is higher than 500, we will display a custom message alerting the user has gone over that character count.

Edit a Validation Rule

From the Schema section in the Builder, select the object where the field is located, where you want to edit your validation rule.

Click the check list icon on the field where the validation rule is saved, and then click on the "Validation Rules" tab to edit those rules.

Delete a Validation Rule

From the Schema section in the Builder, select the object where the field is located with the validation rules. Click the check list icon on the field where the validation rule is saved, and then click on the "Validation Rules" tab to delete a rule.

Click the delete icon on an individual rules to delete the rule.

Uncheck the checkbox "Add field validation rules" to remove all validation rules from the field you are editing.

Unchecking the "Add field validation rules" or the minus icon on an individual rules is destructive and will cause all rule(s) to be removed, so confirm this is the correct action in your app before proceeding.

Multiple Validation Rules

You can add multiple validation rules to a single field to check for different conditions. If no conditions match (that is, if no rules are broken), the field will submit as usual:

When a validation rule finds a match, your user will be notified and the affected field will be highlighted:

Regular Expressions and Validations Rules

  • Regular expressions, or regex, can also be used with validation rules to define the data that users enter. For example, ^[0-9]{8}$ can be used to require 8 numbers and ^[A-Z]{3}$ can be used to require 3 uppercase letters.
  • While we are unable to troubleshoot custom regex, Rubular is a helpful regex editor to test regular expressions as you write them. 
  • Errors with a regular expression can result in a form that's stuck spinning, however, no error message is displayed. If you see this behavior and you're using regular expressions in your validation rules, please check to make sure there are no errors in the regex using Rubular mentioned above.

Notes & Troubleshooting

  • Fields that have at least one validation rule applied will show with a check mark icon adjacent to the field name on the Builder fields page.
  • Validation Rules only work for form submissions and inline edits.
  • Fields that are included in validation rules must be on the view to be validated against.
  • Imports, form rules, and batch updates do not perform validation checks.
  • Validation rules do not check for case-sensitivity. 

How did we do?

Equations

Formulas

Contact