Webform validation (advanced)

Created by Mac Clemmens, Modified on Tue, 11 Mar, 2014 at 4:56 PM by Mac Clemmens

Webforms have the ability to set advanced webform validation conditions, including, but not limited to requiring that at least one of several fields is filled in, requiring specific values, requiring a minimum answer length (in words or # of characters), ensuring that an entered value matches a username, ensuring field has a unique value, checking that two fields have an equal value, etc. You can also set custom error messages if a required condition fails. Here's how.



To add a validation rule, navigate to a post with a webform, and using the edit flyout, choose "Configure Webform" then choose the "Form validation" sub-tab.


You will be presented with a list of types of validation rules. You may add any of the rules. Each and every rule must pass in order for the webform to be submitted. You may even set custom error messages, e.g. ("We're sorry, but the coupon code you entered is not a valid coupon.")


Here are the types of validation rules available:


Numeric values

Verifies that user-entered values are numeric, with the option to specify min and / or max values. (textfield, hidden)


Minimum length

Verifies that a user-entered value contains at least the specified number of characters (textfield, textarea, email, hidden)


Maximum length

Verifies that a user-entered value contains at most the specified number of characters (textfield, textarea, email, hidden)


Minimum number of words

Verifies that a user-entered value contains at least the specified number of words (textfield, textarea, hidden)


Maximum number of words

Verifies that a user-entered value contains at most the specified number of words (textfield, textarea, hidden)


Equal values

Verifies that all specified components contain equal values (textfield, email, select, hidden)


Unique values

Verifies that all specified components contain unique values (textfield, email, select, hidden)


Specific value(s)

Verifies that the specified component contains a defined value (select, textfield, textarea, email, hidden)


Require at least one of two fields

Forces the user to specify / select at least one of two selected webform components (textfield, textarea, email, select)


Require at least one of several fields

Forces the user to specify / select at least one of several selected webform components (textfield, textarea, email, select)


Minimum number of selections required

Forces the user to select at least a defined number of options from the specified webform components (select)


Maximum number of selections allowed

Forces the user to select at most a defined number of options from the specified webform components (select)


Exact number of selections required

Forces the user to select exactly the defined number of options from the specified webform components (select)


Plain text (disallow tags)

Verifies that user-entered data doesn't contain HTML tags (textfield, textarea, email, hidden)


Regular expression

Validates user-entered text against a specified regular expression. Note: don't include delimiters such as /. (textfield, textarea, email, hidden)


Must be empty

Verifies that a specified textfield remains empty - Recommended use case: used as an anti-spam measure by hiding the element with CSS (textfield, hidden)


Words blacklist

Validates that user-entered data doesn't contain any of the specified illegal words (textfield, textarea, email, hidden)


Must match a username

Validates that user-entered data matches a username (textfield, hidden)

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article