Using Validation Rules

Here you will find details on using validation rules in your fields and how they work with your data.

This article covers the following topics:


What is a validation rule?

A validation rule is a customizable criterion used to enforce data accuracy by defining conditions that must be met before the data can be submitted or saved. 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.

Here are some examples of what you can do with validation rules:

  • 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 regular expressions on a short text field

  • Set password minimum and maximum character counts on a User Role password field


Managing Validation Rules

Adding a Validation Rule

From the "Data" section in the Builder, select the table where the field is located. To add a validation rule to a field, you'll need to edit that field.

To do so, select the ellipses icon on the field:


  1. Select the "Validation Rules" option from the dropdown.

  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 table, the condition, and the value. Available conditions will depend on the type of the field chosen.

  4. Type the message you want to appear in the Live App 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 when there is more than one validation rule on a field.



Editing a Validation Rule

To edit a validation rule, head to the Data section in the Builder, and select the table where the field with the validation rule is located. Then, select the checklist icon on the field where the validation rule is saved:



Deleting a Validation Rule

From the Data section in the Builder, select the table where the field is located with the validation rules. Then, select the checklist icon on the field where the validation rule is saved, and select the delete icon on an individual rule to delete the rule.


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

Caution: Unchecking the "Add validation rules" or the minus icon on an individual rule 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 value will submit as usual:


When a validation rule finds a match, the user in your Live App will be notified with a message and the affected field will be highlighted. The user must correct the error before submitting:



Regular Expressions (Regex) and Validation 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.

  • You can learn about, write, and test regex at Regex 101. Use the ECMAScript/Javascript option.

  • 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.


  • Please note that we are unable to provide support for regular expressions. This means that we cannot assist with setup or troubleshooting related to regular expressions.
  • Additionally, as regular expressions involve code-based solutions, we cannot guarantee their functionality or full compatibility with Knack.
  • For resources to help with regex, read more here.


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, when manually adding a record in the Builder, and with inline edits.

  • Fields that are included in validation rules must be included in 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.