Email Field Validation

WS Form uses HTML5 input types to provide built-in validation for common field types, including email addresses. When you add an Email field to your form, it automatically uses HTML5 email validation based on the official specification: RFC 5322.

What Is Valid According to RFC 5322?

RFC 5322 allows a wide range of valid email address formats. For example, the following address is considered valid:

user@localhost

someone@somewhere

While these may not be common in everyday use, they are still valid according to the specification.

This format is technically valid and may be used in internal networks, but it is not recommended for most websites.

How to Require a TLD in an Email Address

If you want to require users to enter a complete email address including a top level domain (TLD), such as test@example.com, you can add a pattern attribute to the field.

.+@.+\..{2,}

This pattern ensures that:

  • The email has valid characters before and after the @ symbol
  • A period and a valid top-level domain (like .com or .org) are included
  • The TLD is at least two characters long

How to Add This Pattern in WS Form

To add this pattern to an Email field:

  1. Click the settings icon on the field.
  2. Click the Advanced tab.
  3. In the Pattern setting enter: .+@.+\..{2,}WS Form - Email Address Validation - Pattern Setting
  4. Click Save & Close.
  5. Publish the form if necessary.

Demo

Additional Resources