Skip to main content

Validation rules

Overview​

Validation rules stop a form from being sent until an answer fits the rule. Most rules are on the Validation tab of a field in the builder. Required is on the General tab, and Input Mask is in the Advanced group of the General tab.

Each rule has a standard message. To use your own wording, fill in the rule's Error Message box, or Required Error Message for Required. A field shows only the rules that fit its type.

Rules and their messages​

The messages are the standard English ones, as a visitor sees them on a Luma store. The wording can differ with your store's language and translations. Unless the table says otherwise, the message appears in red under the field. Rules marked "on leaving the box" also check when the visitor moves to the next field.

Rule Where in the panel What it checks Standard message
Required General tab The field is not empty. "This is a required field." On a Select: "Please select an option." On a Checkbox: "Please select one of the options."
Required Unless This Field Is Filled Validation tab, when Required is off This field or the field you pick is filled in. "First name or Last name is required", with your two labels.
Unique Value Validation → Unique No earlier submission has the same answer in this field. After Submit, a window titled Error: "Duplicate value has been found:" and the answer.
Minimum Length Validation → Length At least this many characters. "Please enter more or equal than 6 symbols." for a minimum of 6.
Maximum Length Validation → Length No more than this many characters. "Please enter less or equal than 40 symbols." for a maximum of 40.
Pattern Validation → Pattern The answer matches a pattern you write. On leaving the box. "Invalid format."
Match Value with Another Field Validation → Match Value, Email field only The address is the same as in another Email field. On leaving the box. 'Please make sure your input matches the "Email".', with the other field's label.
Minimum Selections, Maximum Selections Validation → Selection Limits, Checkbox field How many options the visitor selects. See Checkbox field.
Input Mask General → Advanced The answer fills the mask completely. On leaving the box. "Incorrect value."

WebForms checks Required, Required Unless This Field Is Filled, Pattern, the lengths, Unique Value, Match Value with Another Field and the selection limits again when the form arrives at your store, so a visitor can't skip them by changing the page. Input Mask is checked only in the visitor's browser.

Required unless another field is filled​

Use Required Unless This Field Is Filled when either of two answers is enough, for example a phone number or an email address. The setting is on the Validation tab and shows only while Required is off. Pick the other field in the list.

The panel says: "The visitor must fill in this field or the chosen one. The error shows on this field." With both empty, the visitor sees the message under this field only. Your Required Error Message replaces the standard text. This was tested with two Text fields.

Unique values​

Unique Value compares the answer with every earlier submission of this form, in this one field. Other fields and other forms don't count.

  • Capital and small letters count as the same. "LINA.BERG@example.com" is refused when "lina.berg@example.com" was sent before.
  • The check runs after the visitor clicks Submit. Nothing is saved when it fails.
  • Your text in the Error Message box under Unique Value replaces "Duplicate value has been found".
  • A submission counts whatever its status, and deleting a submission frees its value.

Patterns​

Pattern is for advanced use. A pattern is a regular expression: a short formula that describes the text you allow. Start it with ^ and end it with $ so that it describes the whole answer, not just a part of it. The panel shows an example under the Pattern box. For a 9-digit order number, the pattern ^\d{9}$ accepts "000001380" and refuses "12345".

Write an Error Message for every pattern. The standard "Invalid format." doesn't tell the visitor what to type. A good message gives an example, such as "Enter the 9-digit order number, for example 000001380." Before you publish, open Preview and try one answer that should pass and one that should fail.

Order number box holding 12345, with the help text and the pattern's own red message, Enter the 9-digit order number, for example 000001380

Input masks​

An input mask lets the visitor type only characters that fit a fixed pattern. Enter the mask in Input Mask, in the Advanced group of the General tab. The panel explains the symbols:

Symbol Stands for
9 A digit
a A letter
* A letter or a digit
{min,max} How many times the symbol before it may repeat
[ ] An optional part of the mask

With the mask 99999, the box shows underscores for the five places. Letters the visitor types are ignored, so "ab12" becomes "12___". If the visitor leaves the box before all five digits are in, they see "Incorrect value."

What's next​

  • General field settings: Required, help text and the other settings on the General tab.
  • Email field: ask for an address twice, or match it against another field.
  • Options: the lists behind Select, Radio and Checkbox fields.

Applies to WebForms 4Last reviewed October 14, 2026