Skip to main content
Sep 23, 2015 9:46 PM UTC
Solved

If Known Visitor, Hide Form

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Accepted solution
Sep 24, 2015 10:48 AM UTC

Hi Eric

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

22 replies

Accepted solution
Sep 24, 2015 10:48 AM UTC

Hi Eric

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

Translate
Grant_Booth
Level 9
Sep 24, 2015 4:50 PM UTC

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>

Translate
Kenny_Elkington
Adobe Employee
Adobe Employee
Sep 24, 2015 5:06 PM UTC

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.

Translate
Grant_Booth
Level 9
Sep 24, 2015 5:17 PM UTC

Rereading the original thread, I see I was thinking of a very different situation. Thanks Kenny!

Translate
Oct 27, 2015 11:16 PM UTC

Hi Eric,

I'm trying to understand your use case to see if it is similar to mine. Pretty much, if I have a known visitor, I want them to be able to get to the gated content, without the gate. What did this custom HTML do for you?

Translate
SanfordWhiteman
User Group Leader
User Group Leader
Oct 27, 2015 11:44 PM UTC

The custom HTML (and CSS) ensures that that the act of showing the Known Lead HTML in turn hides the entire form.

Translate
Level 8
Dec 24, 2015 10:00 AM UTC

Hi everyone!

Further to this I'm using pop up forms on a  guided template, and I want to do a  similar thing with those forms, so when it's a know visitor the form doesn't show, it just goes directly to the asset.

Can anyone help?  I tried using this code:

<script>

  document.body.className += ' knownLead';

</script>

Then add Custom CSS to the form:

.knownLead .mktoModal {

  display: none;

}

But it doesn't work.

My test landing page is here:

http://go.cornerstoneondemand.com/Julz-Test.html

Thanks

Juli

Translate
SanfordWhiteman
User Group Leader
User Group Leader
Dec 24, 2015 7:33 PM UTC

In your case the modal uses a different DOM structure (created by the bPopup plugin).

This CSS will hide the form and modal wrapper (together with the Known Lead HTML above, of course).

.knownLead .b-modal.__b-popup1__, .knownLead .mktoForm {

    display: none !important;

}

But I think your goal is slightly different because you don't want to only hide the form, you want to let the person download immediately.  Which means your Known Lead HTML <script> block should probably end with

document.location.href="go.cornerstoneondemand.com/your.pdf";

Translate
Level 8
Dec 24, 2015 7:38 PM UTC

That's excellent thank you so much!

Translate