Skip to main content
Forms are the most common scenario in YiDA. When working with Forms, you often need to validate Fields. In addition to built-in validation rules for various form components, the YiDA platform also provides custom field validation capabilities, helping you manage Form data and prevent dirty data from being submitted. When submitted data fails validation, an error message appears below the Field and the submission is blocked, as shown below:

Validation Settings

The YiDA platform provides two form validation approaches:

Built-in Validation Rules

YiDA offers commonly used built-in validation rules for each form component. Simply configure and enable the rule to use it. For example, the minimum age setting shown above can be easily implemented with the following configuration:

Custom Validation Rules

Built-in field validation methods may not cover every scenario. To address this, YiDA provides a Custom rule setting for each form component, letting you control validation results with a function. The custom validation rule function is defined as follows:
For example, to validate whether the content of a text input Field starts with “Hangzhou”, use the following:

API

Besides being triggered on Form submission, form validation can also be triggered manually via the frontend API, as shown below:

Common Custom Validations

Bank Card Number Validation

Card Number Length Validation

The card number must be 16 or 19 digits.

Card Number Validation

Uses the Luhn algorithm for validation.

ID Card Number Validation