Back to Nocobase

Set Validation Rules

docs/docs/en/interface-builder/fields/field-settings/validation-rules.md

2.1.211.9 KB
Original Source

Set Validation Rules

Introduction

Validation rules are used to ensure that user-input data meets expectations.

Where to Set Field Validation Rules

Configure Validation Rules for Collection Fields

Most fields support the configuration of validation rules. After a field is configured with validation rules, backend validation is triggered when data is submitted. Different types of fields support different validation rules.

  • Date field

  • Number field

  • Text field

    In addition to limiting text length, text fields also support custom regular expressions for more refined validation.

Client-Side Validation Rules in Field Settings

Validation rules set in the field configuration will trigger frontend validation to ensure user input complies with the regulations.

If the corresponding collection field already has validation rules, those rules are shown in the validation settings under Server-side field validation rules. They are inherited from the data source field configuration and are read-only here. If you need to change them, edit the collection field in Data source → Collection configuration.

Rules added under Client-side validation rules only apply to the current field component. They do not change the collection field configuration. When both groups exist, NocoBase applies the inherited field rules and client-side validation rules together.

Text fields also support custom regex validation to meet specific format requirements.