Re: Preventing personal email address being filled out on form

Danielle_Wong
Level 8 - Community Advisor

Re: Preventing personal email address being filled out on form

Thanks so much Sanford!

Danielle_Wong
Level 8 - Community Advisor

Re: Preventing personal email address being filled out on form

Hi Sanford, do you know how to edit the code so that the error alert message appears just above the submit button in addition to near the field? I have a long form, and I'd like the message to appear when they click the submit button so they don't have to scroll up and down looking for why the form isn't submitting. Thank you!

SanfordWhiteman
Level 10 - Community Moderator

Re: Preventing personal email address being filled out on form

The native error message can only be in one place at a time.

But check the CodePen now. I added the option showMessageNearSubmit. If you set this to true (defaults to false) then the message also appears next to the Submit button. You can style the message using CSS.

Danielle_Wong
Level 8 - Community Advisor

Re: Preventing personal email address being filled out on form

Thanks Sanford. I was able to try it out on the codepen link. The code we decided to use is a bit different from yours, so I don't think I can implement your code. For example, here is a sample page with the code we are using. IEEE 

Robb_Barrett
Marketo Employee

Re: Preventing personal email address being filled out on form

Here's an idea - feel free to shoot it down, but...

You would have to make a change to your template. Where you have your other scripts, put in {{my.Custom-Script}}.

Now, copy the above mentioned code, open up notepad, paste it and save it as restrict-public-email.js. Upload it into design studio and grab the URL.

In the programs you want it, past <script src="<insert URL here>"> into your Custom-Script text token.

Robb Barrett
Tom_Liolios4
Level 4

Re: Preventing personal email address being filled out on form

Thanks Robb. I'll definitely try that one out.

Chris_Vanderma1
Level 4

Re: Preventing personal email address being filled out on form

If anyone can't get this script working like I haven't been able to for the last hour, here is a tip. Make sure the script is after the form in the HTML of the page. That solved it for me.