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.
Webform Validation 7.x-1.10 fixes incompatible with Webform 7.x-4.8 (see ) and Webform 7.x-3.x (see ). Upgrading is highly recommended.
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
If you have written your own validation rules, please add them as a patch to the issue queue.
- 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 6.x-2.x, 6.x-3.x, 7.x-3.x, and 7.x-4.x
- Support for Node Clone module
- Support for Select (or Other) module
- Custom error messages are translatable through the Internationalization module
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.
- 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.