Re: Help with code to block internal distribution lists using standard Marketo code

sydney
Level 2

Hello,

 
We are trying to block internal listservs from being able to fill out forms using the standard code provided by Marketo (typically used to block freemail addresses). 
 
When we add the script to a Marketo LP it works perfectly, but when we add it to a page on our site it does not work at all.
 
Here is a URL where the script is live (https://www.numerator.com/ecommerce-acceleration-index). Any help would be greatly appreciated.
5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Don't see a link.

sydney
Level 2

Just updated! 

SanfordWhiteman
Level 10 - Community Moderator

Error in your code.

 

You can't seek the input by id, it has to be by name.

 

var emailElem = form.getFormElem().find("#Email");

 

must be

 

var emailElem = form.getFormElem().find("input[name='Email']");

 

Also, you're including the email validation code twice, should only be once. 

 

(And that code is inherently buggy as it's case-sensitive and doesn't look at domains correctly, but that's another story.)

sydney
Level 2

the error message now appears, but its not picking up the form.submitable(false); line and allowing the form to be submitted

SanfordWhiteman
Level 10 - Community Moderator
  • the code is still looking by id
  • you also have a typo, an extra space after one of the blocked email addresses