Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module adds validation rules to Webform fields, allowing you to enforce specific data requirements. It provides a set of predefined validation options and also allows developers to create custom validation rules.

This module adds an extra tab to each Webform node, allowing you to specify validation rules for your Webform components. You can create one or more of the predefined validation rules, and select which Webform component(s) should be validated against those. By using the hooks provided by this module, you can also define your own validation rules in your own modules.

How to use

Drupal 9+
When you edit any component of a supported type, near the bottom of the edit pane there will be a section called "Form extra validation" which contains the configuration.
Drupal 7
The edit page for a Webform will included a "Form Validation" tab.

Frequently asked questions

Q: Can I validate values against my own dataset, set of codes or database table?
A: You should create your own custom module which hooks into this module. See custom module example.
Q: Can i perform client-side (Javascript) validation with this module?
A: No you can't. Check out the clientside_validation module for this functionality.
Q: Can you help with my regular expression?
A: You can validate against a whole range of things using the regular expressions validation rules, so we cannot give examples for every use case. You could ask for some help in the issue queue with regards to your exact regular expression. There are already some examples available; have a look at Regular Expressions for Webform Validation (thx nfd) and regexlib.com for more examples.

Drupal 9+ features overview

The following validation rules are currently included:

  • Equal values on multiple fields
  • Compare two fields
  • Require at least one of two fields
  • Require at least one of several fields

Drupal 7 features overview

  • Validate Webform form components against a set of predefined validation rules
  • Ability to implement your own validation rules in your module through hook implementations (see this handbook page for more info)
  • Works with Webform 7.x-4.x
  • Support for Node Clone module
  • Support for Select (or Other) module
  • Custom error messages are translatable through the Internationalization module

The following validation rules are currently included:

  • Numeric values (optionally specify min and/or max value)
  • Minimum length
  • Maximum length
  • Minimum number of words
  • Maximum number of words
  • Equal values on multiple fields
  • Unique values on multiple fields
  • Specific value
  • Require at least one of two fields
  • Require at least one of several fields
  • Minimum number of selections required
  • Maximum number of selections allowed
  • Exact number of selections required
  • Plain text (disallow tags)
  • Regular expression
  • Must be empty (anti-spam: Hide with CSS)
  • Words blacklist
  • Must match a username

Activity

Total releases
1
First release
Dec 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Releases

Version Type Release date
2.0.0 Stable Dec 12, 2024