Hi,
I've added Marketo form lightbox code to a Marketo landing page, but when I access the page from a live email (not a test email), the form doesn't prefill with my data. Here’s what I’ve observed:
Any insights on why this might be happening? Please suggest.
Solved! Go to Solution.
Well, like I said above, you can’t use the embed code, which is what you’re doing here. You need to use a proper named <div class="mktoForm" id="unique_id" mktoName="Friendly name in LP Editor">
and choose the form in LP Editor. That’s the only way Marketo knows there’s a form on the page to Pre-Fill from the back end at the time the page is rendered on the server. Otherwise it’s just front-end stuff — Marketo has no idea you’ll be pulling the form embed in at some later.
So what you have now is a <div>
that’s just treated like any other element, and then you’re using the embed code MktoForms2.loadForm()
to render the form. Which works fine but cannot use native Pre-Fill (it could, to be fair, use my non-native SimpleDTO JS to Pre-Fill, but I prefer not to recommend that method unless you know why you need it).
Pre-Fill and Autofill are different.
Pre-fill fills hidden or visible fields from the Marketo database for known leads. Autofill fills hidden fields from query params or cookies. So you meant “Pre-fill” in the subject line.
Anyway, are you using a named Marketo form on your template (i.e. <div class="mktoForm">
) in both cases? This is required for native Pre-Fill; you can’t use the form embed.
Thank you for replying.
Yes, I need to pre-fill the form with data from the Marketo database for known leads when they click the landing page URL from an email. I added the following code to my Marketo landing page to open the form in a lightbox upon page load, but it's not pre-filling as expected.
<div class="mktoForm">
<form id="mktoForm_9898"></form>
</div>
<script>MktoForms2.loadForm("marketo_url", "marketo_id", 9898, function (form){MktoForms2.lightbox(form).show();});</script>
Well, like I said above, you can’t use the embed code, which is what you’re doing here. You need to use a proper named <div class="mktoForm" id="unique_id" mktoName="Friendly name in LP Editor">
and choose the form in LP Editor. That’s the only way Marketo knows there’s a form on the page to Pre-Fill from the back end at the time the page is rendered on the server. Otherwise it’s just front-end stuff — Marketo has no idea you’ll be pulling the form embed in at some later.
So what you have now is a <div>
that’s just treated like any other element, and then you’re using the embed code MktoForms2.loadForm()
to render the form. Which works fine but cannot use native Pre-Fill (it could, to be fair, use my non-native SimpleDTO JS to Pre-Fill, but I prefer not to recommend that method unless you know why you need it).
Thank you @SanfordWhiteman for the clarification.