SOLVED

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

Go to solution
plane
Level 2

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

Awesome, thank you @SanfordWhiteman!! You should definitely work this into a blog post, it'd be helpful to see the build out explained!! I'd also love to see what other cool stuff the email validator script does.

plane
Level 2

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

One other question now that you've updated these @SanfordWhiteman - do I need to re-pull teknkl-formsplus-emailpattern-1.0.3.js from your direct download link, or just copy the updated JS from the codepen/forum post?

SanfordWhiteman
Level 10 - Community Moderator

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

The external JS didn't change. Just the way the onValidate listener works.
plane
Level 2

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

@SanfordWhiteman, I'm having a little trouble with this now that I'm doing some additional testing. It looks like the validation works (I get the error/alert if I use an email on my disallow list) but when I correct the email to an allowed one AFTER having tried a disallowed one, the form won't submit. Any thoughts as to what might be causing this?

VDimitrov
Level 1

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

@SanfordWhiteman I'm having the same issue as Plane: form validation works when an incorrect email is entered, but after changing it to a valid email, the form does not submit. Refreshing the page and entering a valid email does work. Any insight on how to fix that and make it submit when changing an incorrect email to a correct one?

BobLodi
Level 1

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

Same issue here. If I enter a "wrong" email, it shows the alert, but if I change the email to a "good" one, it doesn't submit. If I reload the form and fill it out again, it will submit, FWIW.

SanfordWhiteman
Level 10 - Community Moderator

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

This is expected, since the test form is connected to a real Marketo instance!

 

When the form would successfully submit, I instead stop the submission from going on the wire.

plane
Level 2

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

Sorry @SanfordWhiteman, I think I'm confused. I was testing this on my live forms (and live marketo instance). If I enter a "blocked" email, and hit submit, I get the invalid email error as expected, but if I then change the email to a valid one (note, I haven't refreshed the page) and then click submit again, nothing happens. The form does not submit, no error message, just a broken button. 

I would assume that the desired expected results would be "blocked email + submit = check email -> throw error," then when you correct the email, the results would be "allowed email + submit = check email -> submit form"

 

Could you please explain a little more if I'm missing something? Thanks again for all of your help on this!!

SanfordWhiteman
Level 10 - Community Moderator

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

That’s not the normal behavior in production, though it is deliberately that way in the CodePen. Please link to your page.

plane
Level 2

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

Ah, I see. Here's one of the forms we're currently using it on: https://terakeet.com/seo-blog/content-strategy-playbook-download/ 

To test try using the email "test@gmai.com" we block the domain "gmai" as a misspelling of gmail. enter that email then click the submit button, you should get an error asking for a valid business email. If you change the email to test@gmail.com and then click submit, it should work but doesn't. 

 

Thanks for taking a look @SanfordWhiteman !