Last updated 9 December 2016. Created on 11 September 2010.
Edited by jrockowitz, Liam Morland, sillygwailo, svendecabooter. Log in to edit this page.

The Webform Validation module allows creating advanced validation rules for Webform fields.

Once you have installed the module, an extra tab will appear on the Webform management pages (tab "Edit" in Webform 2.x, tab "Webform" in Webform 3.x/4.x). This extra tab is labeled "Webform validation". Upon selecting this tab, you can choose to add one of the available validation rules to your Webform. Make sure you have added the Webform components you wish to validate before trying to add the validation rule.

After clicking the link to add the desired validation rule, you can specify the following details for your rule:

  • an administrative name to describe the validation rule
  • one or more webform components that should be validated against this rule (depending on the chosen rule, you will have to select a specific number of components for the validation rule to work properly).

Depending on the chosen rule, more form fields will be available on the rules form:

  • optionally an extra setting to further configure the rule
  • optionally a custom error message textfield

Once you have configured your desired validation rules for the selected webform components, every time a user fills in the webform, the validation will be triggered for the selected components, and show the user a standard form error message when entered data doesn't pass the validation rule you have set up.

API for managing Webform Validation rules

You can create Webform Validation rules from your own module using these functions:

Looking for support? Visit the forums, or join #drupal-support in IRC.