SOLVED

Hiding forms for known visitors, but still requiring some fields

Go to solution
SanfordWhiteman
Level 10 - Community Moderator

Re: Hiding forms for known visitors, but still requiring some fields

Hide the default one that comes with the Known Lead HTML. That one is linked to the (invisible) first form. You want the one that comes with the second, visible form.

Jack_Wildt
Level 2

Re: Hiding forms for known visitors, but still requiring some fields

Oh duh, I should have thought about that.

Thank you so much!

Jack_Wildt
Level 2

Re: Hiding forms for known visitors, but still requiring some fields

Sorry to keep asking for things, I really appreciate your help. I am having issues getting the embedded form to lead to the correct confirmation page. I can get it to point to outside urls, but we define the confirmation page using a token, {{my.LPConfirmationPage}}. This is the code I am using.

<span style="color: #ffffff;">Welcome back, {{lead.FirstName}} {{lead.LastName}}</span><br /><span style="color: #ffffff;">{{form.NotYou:default=Not you?}}</span><br /><br />

<script src="//app-ab09.marketo.com/js/forms2/js/forms2.min.js"></script>

<form id="mktoForm_1273"></form>

<script>// <![CDATA[

mktoPreFillFields.filledFields = Object 

  .keys(mktoPreFillFields) 

  .filter(function(field){ 

    return mktoPreFillFields[field] != "null"; 

  });

MktoForms2.loadForm("//app-ab09.marketo.com", "848-AHN-047", 1273, function(form){

form.onSuccess(function(values, followUpUrl) {

location.href = {{my.LPConfirmationPage}};

return false;

});

});

// ]]></script>

SanfordWhiteman
Level 10 - Community Moderator

Re: Hiding forms for known visitors, but still requiring some fields

You can't use the token there.

I'd pull the onSuccess() out of the Known Lead HTML. Just have that in the page on its own:

MktoForms2.whenReady(function(form){ 

  form.onSuccess(function(values, followUpUrl) { 

    location.href = {{my.LPConfirmationPage}}; 

    return false

  }); 

});

In the Known Lead HTML, skip the last argument to loadForm():

MktoForms2.loadForm("//app-ab09.marketo.com", "848-AHN-047", 1273)