Validation Configuration
Validation rules support required validation, numeric range, length limits, regex matching, and custom rules. You can set multiple trigger methods to ensure form data accuracy and completeness.
1. Overview
Validation rules constrain and check input data to ensure accuracy, completeness, and compliance. Key features include:
- Required Setting: Specifies whether a field is required. Required fields must have a value before submission.
- Maximum/Minimum Value Validation: Sets allowed value ranges for numeric data. Input must be within the specified range or it's considered invalid.
- Length Validation: Specifies maximum and minimum length for string data. Input that exceeds or falls short of the required length triggers validation failure.
- Regular Expression Validation: Uses regex patterns to validate input format, such as email addresses, phone numbers, ID card numbers, etc.
- Custom Validation: Allows developers to write custom validation functions when built-in rules don't meet complex business requirements.
2. Use Case Examples
- User Registration Form
- Required Setting: Fields like username, password, and email are usually set as required to ensure users provide basic information.
- Length Validation: Password field may require length between 6-20 characters to ensure password complexity.
- Regular Expression Validation: Email field uses regular expressions to validate format correctness, such as
^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$.
- Product Information Form
- Required Setting: Product name, price, stock quantity, etc. are required fields to ensure complete product information.
- Maximum/Minimum Value Validation: Price and stock quantity fields set minimum value to 0 to avoid unreasonable data like negative numbers.
- Length Validation: Product description field limits maximum length to prevent users from entering overly long descriptions that affect page display.
3. Configuration
3.1 Required Setting
After enabling required, you can add required prompt text. Required fields cannot be submitted without input.

The prompt text function is as follows:

3.2 Validation Rules
Maximum/Minimum Value
Description: Maximum/minimum values limit numeric ranges, e.g., boundary constraints for amount input.
Use Case Example: Reimbursement amount minimum value is 0.01, maximum value is 999999.99.

Error prompt text setting is as follows:


Length Validation
Description: Length validation checks input character length. When validation fails, error information is displayed.
Use Case Example: Phone number must be 11 digits.

Error prompt text setting is as follows:

Regular Expression Validation
Description: Use regular expressions to validate formats like email addresses and phone numbers.
Use cases include: email, domain name, phone number, landline phone, ID card number, bank card number, license plate number, Chinese characters, numbers, integers, positive integers, negative integers, floating point numbers, positive floating point numbers, negative floating point numbers, English letters, numbers and letters

Custom Validation
Description: Create custom validation rules for special cases that built-in rules don't cover.


3.3 Validation Methods
Validation methods include on blur, on change, and on submit. You can select one validation method to trigger validation.

- On blur: Triggers when the field loses focus
- On change: Triggers when the input content changes
- On submit: Triggers when the submit button is clicked


