Adding & Managing Validation Rules

Learn how to create, edit, and manage validation rules to ensure data quality in your Knack application.

What You'll Learn

This guide walks you through the process of setting up validation rules for your fields. You'll discover how to add new rules, edit existing ones, implement multiple conditions, and remove rules when they're no longer needed.

Adding a Validation Rule

To add a validation rule to a field:

  1. Select the DataTable containing the field you want to validate
  2. From the right panel, select the Validation Rules icon
  3. Click + Validation Rule
Add validatio rule

Add Validation Rules from the right panel

  1. Configure your rule with three components:
    • When: Select a field, one or more conditions, and value
    • Show Message: Enter the error message to display when validation fails
    • Save
add validation rule

Add a Validation Rule

The conditions available in the dropdown will depend on the type of field you're working with. For example:

  • Text fields: Contains, Does not contain, Is, Is not, etc.
  • Number fields: Is higher than, Is lower than, Is not, etc.
  • Date fields: Is after, Is before, Is between, etc.

Edit, Duplicate, or Delete a Validation Rule

To modify an existing validation rule:

  1. Select the DataTable containing the field with the rule
  2. Open Validation Rules in the right panel
  3. Hover in the validation rule and select the Edit, Duplicate, or Delete icon.
  4. Save your changes
editing validation rule

Edit, Duplicate, or Delete a Validation Rule

🚧

Deleting the Validation Rule will permanently remove the rule(s). Confirm this is the correct action before proceeding.


Multiple Validation Rules

You can add multiple validation rules to a single field to check for different conditions. This allows for more comprehensive validation:

  1. Create your first validation rule
  2. Click the "Add Condition" button to add another condition

When multiple rules are applied:

  • All rules must pass for the data to be accepted
  • If any rule fails, the corresponding error message will be displayed
  • The field will be highlighted to indicate validation failure
multiple rules

Multiple conditions in a Validation Rule


Notes & Troubleshooting

  • Validation rules work for:
    • Form submissions
    • Manual record additions and edits in the DataTable
    • Record additions and edits in the Live App
  • Fields used in validation rules must be included in the Live App's element to be validated
  • Validation rules are not checked during:
    • Imports into the DataTable
  • Validation rules do not check for case-sensitivity

Tip: Write clear, specific error messages that tell users exactly what they need to fix. For example, "Date of birth must not be in the future" is more helpful than "Invalid date"


What’s Next