SOLVED

Auto Fill Embedded Forms (not on Marketo landing page)

Go to solution
Anonymous
Not applicable

Re: Auto Fill Embedded Forms (not on Marketo landing page)

Ahhh, makes sense. That's an unusual wrinkle with Marketo behavior about needing all 3 fields to be populated, but the good news (and I just successfully tested to confirm) is that the mkto_token does work as hoped for un-cookied email clicks, it's just that our test account was incomplete. I'll make sure that our leads get populated with at least default values for first name and last name, and we'll be set. Thank you so much Sanford for your help on this!

SanfordWhiteman
Level 10 - Community Moderator

Re: Auto Fill Embedded Forms (not on Marketo landing page)

Cool, if you could mark one of my answers as ​Correct...

Eric_Salamon1
Level 6

Re: Auto Fill Embedded Forms (not on Marketo landing page)

Sorry for the delay. I have been in and out of the community but thank you for all the assistance. You have been a life saver!

Prakash_Mohanda
Level 2

Re: Auto Fill Embedded Forms (not on Marketo landing page)

Sanford Whiteman I am having a similar issue with prepop on a form that is embedded via html and script on a landing page.

Basically i am trying the below code onto my form that adds an alternate submit button . The lead identification (cookie) seems to work just fine because i see the data going into marketo to the correct lead when the alternate button is pressed. However the form itself doesn't pre-pop with already entered information for the lead.  When alternatively i just use the form element directly on the landing page it works just fine on the pre-pop instead of the html code and embed.  I also commented out the additional button part of the script and just did a simple form embed code with html and in that case too it doesn't prepop.

<!doctype html>

<html>

  <head>

    <meta charset="utf-8">

  </head>

  <body>

<p> <Center>

      <button id='MyAlternativeSubmitButtonId'>Save progress</button>

    </p>

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

    <form id="mktoForm_128"></form>

     <script>MktoForms2.loadForm("//app-ab22.marketo.com", "876-MVP-978", 128);

      //find the button element that you want to attach the event to.

       var btn = document.getElementById("MyAlternativeSubmitButtonId");

       btn.onclick = function(){

        //When the button is clicked, get the form object and submit it.

        MktoForms2.whenReady(function (form){

          form.submit();

        });

      };

    </script>

  </body>

</html>

SanfordWhiteman
Level 10 - Community Moderator

Re: Auto Fill Embedded Forms (not on Marketo landing page)

Let's use the Marketo term "Pre-Fill" instead of "prepop."

On Marketo-hosted LPs, you need to use a named Marketo form (mktoForm element) for native Pre-Fill to work.  If you use the embed code instead on a Marketo LP, this is treated the same as on a 3rd-party site, where native Pre-Fill is disabled.  There's no need for you to use the embed code here, just put you custom code just in a <script> before the closing </body> tag.