Gravity Wiz

Magically enhanced tutorials, snippets and plugins for Gravity Forms!

  • Gravity Perks
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    • Documentation
    • Support
    • Account

Gravity Forms Email Validation: Check Emails Live Prior to Submission

Use this guide to learn how to validate a Gravity Forms Email field live before needing to click submit.

Last updated June 30, 2022 | Written by Scott Buchmann Leave a Comment

This article requires the GP Populate Anything perk. Buy Gravity Perks today to get this perk plus 42 other premium Gravity Forms plugins!

  • View the Plugin
  • Buy Gravity Perks

In this tutorial, we’re going to walk you through how to set up Gravity Forms email validation to check a user’s email live and prevent submissions if that email already exists.

gravity forms email validation

Extensible and powerful user management is a staple of WordPress. Not only are the built-in tools strong, the amount of plugins available to alter and supplement user management is incredible. Gravity Forms is a proud member of that group. With the User Registration Add-On, new users can easily sign up for a WordPress account using a Gravity Form. This opens the user registration process to a whole world of possibilities.

One of our users recently reached out asking for a way to check if an email already exists in their user registration form. Gravity Forms automatically validates the email and returns an error if the submitted email already has a user account associated with it, but this customer wanted to prevent those users from wasting their time filling out an unnecessary form.

Getting Started

This article will use Populate Anything to validate the entered email against existing users. If the email already exists, we will prevent the submission and display a link to the login page using Conditional Logic.

Steps

  1. Add an Email Field
  2. Add a Hidden Field and Populate Emails
  3. Add an HTML Field and Configure Conditional Logic
  4. Configure Submit Button Conditional Logic

Step 1 – Add an Email Field

User registration requires a valid email, so add one to your form if you haven’t already.

gravity forms add an email field

Step 2 – Add a Hidden Field and Populate Emails

Next, add a Hidden field to your form. In that Hidden field, we’re going to populate from the User object. Add a Filter Group and set the filter to match the “User Email” with your email field.

how to add a hidden field and populate emails in Gravity Forms

Leave the Value Template to the default of “User ID”.

setting up the value template in Gravity Forms

With these settings in place, if the user enters an Email that is connected to an existing user account, the user ID will populate. Otherwise, the field’s value will be blank.

Step 3 – Add an HTML Field and Configure Conditional Logic

Next, add an HTML field. In this field, insert a message and link to your login page.

Add an HTML field and configure conditional logic

Using Conditional Logic, we’re going to only display this field if the entered email exists. Set the conditional logic operator to “greater than” and set the value to 0. Since we’re populating the User ID into the “Email Exists” field, and no users have an ID of 0, we simply need to check if the populated User ID is greater than 0. If yes, the email is attached to an account, and we’ll show the HTML field.

enabling conditional logic in gravity forms

Looking to block certain emails entirely? Use Gravity Forms Blocklist to prevent submissions with specific keywords or IPs.

Step 3 – Configure Submit Button Conditional Logic

We’ll use the same Conditional Logic on the Submit button to prevent the user from being able to submit the form if the entered email exists. The only difference is that we’ll set it to Hide the button instead of show it.

configuring submit button conditional logic in gravity forms

That’s It

If you haven’t already set up the User Registration feed, go to the form’s Settings > User Registration and add a new Create User feed. You’ll be asked to map your fields to the new user’s profile. You can read more about setting things up in the docs.

With everything set up, your user registration form will prevent an existing user from attempting to register with an existing email. If they do, the Submit button is hidden and we present them with a login link.

gravity forms live email validation response message

More on Gravity Forms Validation

  • Gravity Forms Zip Code Validation: A Step by Step Guide
  • Gravity Forms Age Verification: How to Set Up Age-based Validation
  • Make Your Gravity Forms Validation Errors Mobile Friendly(er)
  • Require an Existing Value for Submission with Gravity Forms

Did this resource help you do something awesome with Gravity Forms? Then you'll absolutely love Gravity Perks; a suite of 41+ essential add-ons for Gravity Forms with support you can count on.

  • View All Perks
  • Buy Gravity Perks

Filed Under: How To gp populate anything user registration validation

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.

Recent Posts

  • How ANM Powers Internal Finances with GP Unique ID
  • New Release: Gravity Forms QR Code Beta 1
  • How Farbie.at uses GP Inventory to manage over one thousand parties a year
  • Spotlight: Building a Loan Calculator with GP Advanced Calculations
  • Gravity Forms Email Validation: Check Emails Live Prior to Submission

Categories

  • How To (73)
  • News (25)
  • Plugins (19)
  • Releases (13)
  • Resource (3)
  • Snippets (50)
  • Spotlights (14)
  • Tutorials (57)
  • Uncategorized (4)
  • Updates (152)

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 2022 · Powered by WordPress · Gravity Wiz LLC

  • Support
  • Affiliates
  • About
  • Sitemap
  • Terms & Conditions of Use
  • Privacy Policy
  • Cookies Policy

Get access to hundreds of Gravity Forms plugins for free!

Enter your email and receive a list of our most popular free snippets and plugins for Gravity Forms.

  • Gravity Perks
    ▼
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    ▼
    • Documentation
    • Support
    • Account