Solved

Exclude .edu domains

  • 10 November 2022
  • 2 replies
  • 24 views

Badge

Good afternoon!

We are looking for a way to exclude the emails we receive in our forms with ".edu" domains. For example, email@example.edu. And that the user gets a warning that they must provide a corporate mailbox.

But so far, we have yet to find the script for this. Does anyone know how to do it, or do you have a script that works for you?

Thanks!

icon

Best answer by PIvaldi95 27 December 2022, 13:46

View original

2 replies

Userlevel 3
Badge

Hey @PIvaldi95, we have a business email only script in our community that you can find here:

 

 

You would want to modify the script and add the ‘edu’ domain to the regex, so for example in this part you can add ‘edu’ at the end of the list after the other blocked domains, don’t forget to add a ‘|’ in between:

 

(me|mac|icloud|gmail|googlemail|hotmail|live|msn|outlook|yahoo|ymail|aol|edu)

 

I hope this helps @PIvaldi95! Let me know if you have any trouble implementing this and we can run your page by our support team! 😎

Badge

Good morning and thank you for your response!

We found the solution in another community thread, and the script we ended up using is this one:

 

<script>
  window.ub.form.customValidators.nonWebmailEmail = {
    isValid: function(value) {
      return !(/\@(me|mac|icloud|email|gmail|googlemail|hotmail|live|msn|outlook|yahoo|ymail|aol|edu|alumnos|gamil|alumno)\./.test(value.toLowerCase()) || /(\.edu)/.test(value.toLowerCase()));
    },
    message: 'Por favor, ingresa tu mail corporativo.',
  };
</script>
<script>
window.module.lp.form.data.validationRules['email'].nonWebmailEmail = true;
</script>

 

Have a great 2023!

Reply