docs/docs/en/data-sources/data-modeling/collection-fields/validation.md
To ensure collection accuracy, security, and consistency, NocoBase provides field validation. It has two parts: configuration rules and validation rules.
NocoBase field rules integrate Joi. The supported rules are as follows.
NocoBase Field interfaces corresponding to Joi string types include Input, Textarea, Phone, Email, URL, Password, and UUID.
NocoBase Field interfaces corresponding to Joi number types include Integer, Number, and Percent.
In addition to common rules, Integer fields support integer validation and unsafe-integer validation.
In addition to common rules, Number and Percent fields support precision validation.
NocoBase Field interfaces corresponding to Joi date types include DateTime (with time zone), DateTime (without time zone), Date only, and Unix timestamp.
Supported validation rules are:
Relation fields support required validation only. Note that required validation for relation fields is not currently supported in Subform or Subtable scenarios.
After you configure field rules, the corresponding validation rules are triggered when data is created or changed.
When a field is used in a form, its validation rules also appear in the field validation settings. They are displayed as read-only under Server-side field validation rules. To change these rules, return to Data source / Collection configuration and edit the field.
You can still add additional rules for the current form field under Client-side validation rules. These rules affect only the current field component. The validation rules that ultimately take effect combine Server-side field validation rules and Client-side validation rules.
Validation rules also apply to Subtable and Subform components:
Note that required validation for relation fields does not take effect in Subform or Subtable scenarios.
Server-side field validation rules and client-side validation rules are configured in different places and have different scopes.