SOLVED

If Known Visitor, Hide Form

Go to solution
Anonymous
Not applicable

Most pages on my site I won't want forms. There are some more valuable pieces of content I want to put behind forms, but I don't want to make people submit 20 forms to read my 20 best articles.

I don't really like the if known show custom HTML functionality in forms 2.0 either. Is there a way to hide the form and custom HTML if I get a known visitor? Munchkin already tracks page visits for known visitors, so I'd like to hide the form.

Anybody else feel this pain and solve it?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi Eric

If you change HTML to <div></div> at custom HTML editor,show nothing.

Screen Shot 2015-09-24 at 19.45.58.png

View solution in original post

22 REPLIES 22
Grant_Booth
Level 10

Hi Eric,

Takehiro's answer is definitely the simplest. Alternatively, you could use example #1 at our developer documentation:

Forms 2.0 » Marketo Developers

and add this in an HTML block on the page:

<script>

MktoForms2.whenReady(function (form) {

 

   // Add an onSuccess handler

  form.onSuccess(function(values, followUpUrl) {

   // Get the form's jQuery element and hide it

  form.getFormElem().hide();

   // Return false to prevent the submission handler from taking the lead to the follow up url

   return false;

   });

});

</script>

Kenny_Elkington
Marketo Employee

This example only applies upon successful submission.  There's a few ways to do it with the API, but Takehiro's is the most elegant one.