Lightbox not pre-filling -- on Marketo page

JD_Nelson
Level 10 - Community Advisor

Lightbox not pre-filling -- on Marketo page

I put a lightbox embed code for the onclick of a button, but the lightbox form isn't pre-filling known users. I understand why it doesn't on pre-fill on non-marketo pages, but hoping I can add something to the code to pull in some info?  Thanks in advance.

<button onclick="

    MktoForms2.loadForm("//app-ab11.marketo.com", "{{mkto ID}}", {{form#}},

    function (form){MktoForms2.lightbox(form).show();});">

CLICK HERE

</button>

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: Lightbox not pre-filling -- on Marketo page

When you use the embed code on a Marketo page, you are bypassing the Marketo named form element, thus Marketo does not include the form prefill fields (your JS block might as well be any old JS -- Marketo doesn't seek to inspect it for Marketo-like stuff, nor should they).

While you can easily simulate prefill by using tokens (see my comment on ​) I don't see why you're not using a form element here.  You can pop up the lightbox even with a form element.

MktoForms2.whenReady(function(form){
  MktoForms2.lightbox(form).show();

});

I also strongly recommend you add this CSS whenever you use the lightbox feature:

.mktoForm {

  visibility: hidden;

}

.mktoModal .mktoForm {

  visibility: visible;

}