Solved

[How To] Require A Business Email In Your Unbounce Forms


Userlevel 7
Badge +1
  • Former Community Manager @ Unbounce
  • 831 replies

From time to time, it’s a good option to prevent “free” or “personal” email address form submissions in your landing pages – this really depends on what kind of campaign you’re running.

This has come up here in the community before (here, here, and here) so I thought it might be a good idea to create a single post with the most up-to-date solution for this.

In this post shared by @Mark_Wainwright (one of Unbounce’s superstar software developers), he demonstrates how to add custom validation in Unbounce form fields. Here are the instructions to prevent free/personal email address form submissions in your Unbounce landing pages:

Apply the rule to the form field

Step 1. Copy the following script and paste it into the Javascripts section of the builder, placement: BEFORE BODY END TAG:

<script>
  window.ub.form.customValidators.nonWebmailEmail = {
    isValid: function(value) {
      return /\@(?!(me|mac|icloud|gmail|googlemail|hotmail|live|msn|outlook|yahoo|ymail|aol)\.)/.test(value.toLowerCase());
    },
    message: 'Please enter your work email address',
  };
</script>
<script>
window.module.lp.form.data.validationRules['my_form_field'].nonWebmailEmail = true;
</script>

Step 2. Replace my_form_field with the ID of the form field you want to apply the rule to

View the original post here, which goes into more detail of adding custom validations to form fields.


Boom! You’re done. 💥

icon

Best answer by Bruna_Tavares 29 September 2020, 23:13

View original

30 replies

Hi, anyone knows a code do to validate personal emails too (gmail, yahoo, hotmail, etc) and not only work emails? 

 

Badge

@TomAdbetter and @Vic03 we also have the same problem with Hubspot. Did either of you find a solution?

@TomAdbetter and @Vic03 we also have the same problem with Hubspot. Did either of you find a solution?

Hi @Metro_Group 

Unfortunately, My team and I didn't find a solution to this problem. We decided to embed the form instead of using the Unbounce integration. However, we still receive spam leads from this solution, mostly from Display ads, but we don't have the integration problem anymore. 

Sorry for not having a clear solution for this problem. 
 

Userlevel 2
Badge

@Vic03 @TomAdbetter 

Hope you are all doing well! I was able to reach out to our Tech Team and you may be able to omit those emails that the code is blocking from heading over to HubSpot. Try disabling the “Non-HubSpot Forms” feature in HubSpot settings. 

https://knowledge.hubspot.com/forms/use-non-hubspot-forms#supported-forms

This is an explanation from their product team of why all leads are sent over:

https://community.hubspot.com/t5/Lead-Capture-Tools/Hubspot-Collecting-Multiple-Incomplete-Gravity-Form-Forms/m-p/202862/highlight/true#M1626

Hope this helps!

Badge

Does anyone know what code to add onto a smart builder page and where this gets added? The script i use for normal builder is not working.

Reply