How to Restrict Free Email Domains on Form Fill Out in 2021 | Community
Skip to main content
Level 2
April 9, 2021
Solved

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

  • April 9, 2021
  • 1 reply
  • 15698 views

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?

Best answer by SanfordWhiteman

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!)

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
April 9, 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!)

Level 2
April 9, 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
April 9, 2021

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