Field validation

This module provides a collection of configurable validation rules for your field instances.

Available validators

7.x 8.x
Color (HTML5) βœ“ (*)
Date range βœ“ βœ“
Date (ISO) βœ“ (*)
EAN number βœ“ (*)
Email βœ“ βœ“
Equal values on multiple fields βœ“ βœ“
Field collection unique βœ“ (*)
Integer values βœ“ (*) βœ“
IP Address βœ“ (*) βœ“
Length (optionally specify min and / max length) βœ“ βœ“
Match against a field βœ“ βœ“
Match against a property βœ“
Must be empty (Anti-Spam: hide with CSS) βœ“ βœ“
Number of words (optionally specify min / max words) βœ“ βœ“
Numeric values (optionally specify min / max value) βœ“ βœ“
Numeric (HTML5, with min / max / step options) βœ“ (*)
Pattern (regular expression lite) βœ“ βœ“
Phone βœ“ (*) βœ“
PHP code (powerfull but dangerous) βœ“
Plain text (disallow tags) βœ“ βœ“
Postal code (depend on Postal Code Validation, support Address Field) βœ“ (*)
Regular expression βœ“ βœ“
Regular expression (Perl-Compatible) βœ“ (*)
Require at least one of several fields βœ“ βœ“
Require some of several fields βœ“ (*)
Required field βœ“ (*)
Specific value(s) βœ“ βœ“
Unique βœ“ βœ“
Unique values on multiple fields βœ“
URL (support internal path and external URL validation) βœ“ βœ“
Words blacklist βœ“ βœ“

(*) = provided by the (included) field_validation_extras submodule in 7.x

Since 7.x-2.1, we add another sub module property validation which could solve validation issues for property(non-field), such as title, Ubercat SKU, list_price.

Drupal 8, 9, 10

You need clear the cache if it is not works correctly

In Drupal 8, validators are plugins, you can program your own validator or extend some of the existing.

3.0.x version allow you add Drupal'core constraint to field by UI. it support 40+ symfony constraints. Callback allow you write custom code, Expression allow you use twig-like expression...

Update from 8.x-1.x to 3.0.0

Requirements

7.x

8.x

Just Drupal core.

Documentation

Authour:

Howard Ge
The author can be contacted for paid customizations of this module as well as Drupal consulting and development.

Short name
field_validation
Supporting organizations
8.x branch maintenance