Page Builder Summit Limited Time Offer - 20% OFF! Use coupon PBS20 - View Details

Using RegEx Pattern Attributes on Field Inputs

The form below demonstrates the use of the Pattern setting found in the Advanced tab of form input fields. The Pattern setting sets the pattern attribute on form inputs.

WS Form - Field Advanced Tab - Pattern Setting

The pattern attribute in HTML form inputs is used to define a regular expression (regex) that the input field’s value must match for the form to be submitted successfully. This attribute is particularly useful for validating the format of user input directly in the browser, without needing to rely on server-side validation.

The pattern attribute can be applied to several field types, such as Text, Date/Time, Email, and Phone. When a user enters data that doesn’t conform to the specified regex, the browser will block the submission of the form and WS Form will show invalid feedback against that field.

Learn more: mdn web docs: HTML attribute: pattern