Log In Sign Up
HomeExamplesValid Library: Validation Type Examples

Valid Library: Validation Type Examples

Category: Examples
The Valid validation module performs value validation on form fields. It requires the form field to have a 'name' attribute and is best used within a 'form' node. When submitting the form, 'validate' supports secondary validation. It also supports asynchronous Ajax validation. Built-in validations include value type checks, value strength checks, string inclusion checks, numerical range checks, and quantity checks. Additionally, it supports custom validation methods.

Fixed Format Validation

For common string formats like email, IP addresses, credit cards, etc., this validation module includes several built-in format validations so users don't need to write custom validation rules.

Character Type Validation

This library supports validation for common character types.

Date Validation

This library supports validation for common date types.

Numeric Range Validation

This library supports validation for common numeric range types.

Character Length Validation

This library supports validation for common character length types.

Inclusion and Exclusion Validation

  • include: Requires inclusion validation
  • exclude: Requires exclusion validation

Asynchronous Validation

Asynchronous validation refers to submitting form data to a dynamic page for validation and receiving the result. The syntax is: async:url.

Selection Count Validation

For dropdown menus and multi-select checkbox controls, this module provides the following selection count validations:

Multi-File Validation

Selection count validation can be applied to multi-file file controls.

Also works with custom file components and upload components. Suitable for using input and change trigger events.

Multi-Select Validation

Selection count validation can be applied to select-multiple controls.

Also works with custom select components. Suitable for using input and change trigger events.

Multi-Input Validation

Selection count validation can be applied to plain text controls. If the text contains commas ,, the text will be converted to an array and its length will be used for validation. If a custom separator is needed, use the separator parameter.

Consistency Validation

When registering accounts/passwords, password confirmation is typically required, meaning two field values must match. This can be validated using the same type. Syntax: type:{same:['name','label']}.

The opposite of same validation is different validation, with the same syntax but opposite meaning. Syntax: type:{different:['name','label']}.

Strength Validation

This module includes a simple strength calculation method. Strength is increased by:

Character Type and Count Validation

When validation requires specific character types and counts, use the specific validation type. Syntax: type:{specific:'a=2&A&d&~{6,10}'}.

Type Count Validation

To validate "at least 3 character types", use the combine validation type. Syntax: type:{combine:'aA~:2{6,10}'}.

Multiple Validations

The type parameter can accept multiple validation types. Syntax examples:

New Launch: 20% Off All Products

Unlock all examples and development resources