SOLVED

Re: How to Restrict Free Email Domains on Form Fill Out in 2021

Go to solution
Chris_Goelkel
Level 2

How to Restrict Free Email Domains on Form Fill Out in 2021

Is there a new way to do this since this old Blog Article in 2014. This doesn't seem to work for me. 

If you reference this old post (https://developers.marketo.com/blog/restrict-free-email-domains-on-form-fill-out/) it says you can block whatever domain you want on the front side of the form. But I believe some calls have changed, and the script is not working.  Has anyone else run across this issue?

 

This seems like a out of date method, is there a better way?

2 ACCEPTED SOLUTIONS

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: How to Restrict Free Email Domains on Form Fill Out in 2021

Use the new FormsPlus::EmailPattern JS.

 

You can see a demo here:

 

MktoForms2 :: FormsPlus-EmailPattern [simple demo]

 

Download the JS library from the CodePen HTML pane (direct download link here) and re-host it in your Design Studio.


Then add the code from the CodePen JS pane anywhere after your form embed. Add blockable domains to the invalidDomains array. It accepts 3 different formats:

 

mailbox@example.com  - matches one specific email address

example.com - matches all mailboxes @ that domain

mailbox@ - blocks that mailbox @ any domain

 

(actually it does even more cool stuff but I haven't had time to document it yet!)

View solution in original post

SanfordWhiteman
Level 10 - Community Moderator

Re: How to Restrict Free Email Domains on Form Fill Out in 2021

Because they failed to account for onValidate chain in their code, setting submittable(true) no matter what else was running.

View solution in original post

36 REPLIES 36
SanfordWhiteman
Level 10 - Community Moderator

Re: How to Restrict Free Email Domains on Form Fill Out in 2021

Use the new FormsPlus::EmailPattern JS.

 

You can see a demo here:

 

MktoForms2 :: FormsPlus-EmailPattern [simple demo]

 

Download the JS library from the CodePen HTML pane (direct download link here) and re-host it in your Design Studio.


Then add the code from the CodePen JS pane anywhere after your form embed. Add blockable domains to the invalidDomains array. It accepts 3 different formats:

 

mailbox@example.com  - matches one specific email address

example.com - matches all mailboxes @ that domain

mailbox@ - blocks that mailbox @ any domain

 

(actually it does even more cool stuff but I haven't had time to document it yet!)

Chris_Goelkel
Level 2

Re: How to Restrict Free Email Domains on Form Fill Out in 2021

Thanks @SanfordWhiteman 

I am trying to make this work, but first try was unsuccessful. 

You Said I should upload a copy of that JS to my Marketo Library correct, then call that version. It's acting like it's not calling it.

SanfordWhiteman
Level 10 - Community Moderator

Re: How to Restrict Free Email Domains on Form Fill Out in 2021

You'd need to provide a link to your page. Can't tell what's going on without that.

Chris_Goelkel
Level 2

Re: How to Restrict Free Email Domains on Form Fill Out in 2021

@SanfordWhiteman I don't have it on a public server you can get to unfortunately but can you confirm I am calling the correct code:

This would be what I would call under my form code correct. 

 

 

<!-- FormsPlus libraries -->
<script id="teknklFormsPlus-EmailPattern-1.0.3" src="https://your-marketo-domain/rs/765-HCI-927/images/formsplus-emailpattern-1.0.3.js"></script>
<!-- /FormsPlus libraries -->

 

 

 

SanfordWhiteman
Level 10 - Community Moderator

Re: How to Restrict Free Email Domains on Form Fill Out in 2021

Yes, that plus the code from the CodePen JS pane of course.
Chris_Goelkel
Level 2

Re: How to Restrict Free Email Domains on Form Fill Out in 2021

Thank You Very Much @SanfordWhiteman , This is a Powerful little script! Nicely done. 

SanfordWhiteman
Level 10 - Community Moderator

Re: How to Restrict Free Email Domains on Form Fill Out in 2021

Glad you like it. When I reveal the other thing it can do, you might like it more!
Chris_Goelkel
Level 2

Re: How to Restrict Free Email Domains on Form Fill Out in 2021

I look forward to it, by the way the reason it didn't work for me originally was the order it was firing in, incase anyone else runs into that. 

laberge
Level 1

Re: How to Restrict Free Email Domains on Form Fill Out in 2021

Hey Sandy,

 

I've just been testing this script here and our forms use a different button (for some other webhooks) - I see the script triggers correctly but the button we use seems to ignore the ability to block the form submission. I can see it says "must be a valid email" but it doesn't seem to stop the submission. Any chance you could glance at it quickly

 

It's been a while (and a few companies) since I've asked you a question 🙂 hope all is well.

 

-Justin