SOLVED

Re: Two 'pop-up' forms on one Marketo LP?

Go to solution
Julz_James
Level 10

Two 'pop-up' forms on one Marketo LP?

Hi all,

I've been searching and haven't quite got the answer I'm looking for, but I'm looking to get 2 forms on one Marketo Landing page, but these forms need to 'pop-up' when a button is clicked.

Can anyone help?

Thanks

Julz

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Two 'pop-up' forms on one Marketo LP?

2 different forms using MktoForms2.lightbox() work as well as 2 forms without the lightbox -- that is, they mostly works and get the job done, with some minor quirks (which I've not yet published officially on the blog but have mentioned in some posts here).

Example from a couple years ago: https://codepen.io/figureone/pen/QjjwMB?editors=1010

View solution in original post

20 REPLIES 20
SanfordWhiteman
Level 10 - Community Moderator

Re: Two 'pop-up' forms on one Marketo LP?

2 different forms using MktoForms2.lightbox() work as well as 2 forms without the lightbox -- that is, they mostly works and get the job done, with some minor quirks (which I've not yet published officially on the blog but have mentioned in some posts here).

Example from a couple years ago: https://codepen.io/figureone/pen/QjjwMB?editors=1010

Julz_James
Level 10

Re: Two 'pop-up' forms on one Marketo LP?

Hi Sandy,

Thanks for this.  I looked at your other post about 2 forms on 1 page but that was an external page.  I'll give this code a go and see how it works.

Thank you

SanfordWhiteman
Level 10 - Community Moderator

Re: Two 'pop-up' forms on one Marketo LP?

... but that was an external page.

Lightboxing named mktoForm elements on a Marketo-hosted LP is indeed harder than on an external page.

This is because a named form wants to pop up immediately, as opposed to being triggered by a button click. However, if you hide (visibility: hidden; position; absolute, not display:none) the form until the modal is visible w/the form inside, you can get the same control. (When using a lightbox, hiding and showing is advisable in all cases.)

Or you can use the embed code on the Marketo LP instead of the named form. The principal drawback there is then you have to re-add Pre-Fill.

Julz_James
Level 10

Re: Two 'pop-up' forms on one Marketo LP?

Hi Sanford Whiteman

I've managed to get everything to work in the code pen you linked but I can't get it to work on the Guided LP.  I've put the HTML code within the HTML of the Rich Text Editor Box where I want the buttons to appear and then I've put the JS into the Custom Head HTML of the LP and wrapped that JS with <script></script>, but no forms are popping up.

Any help would be much appreciated 🙂

Thanks

Julz

SanfordWhiteman
Level 10 - Community Moderator

Re: Two 'pop-up' forms on one Marketo LP?

Need an example URL.

I wouldn't put this stuff in Rich Text boxes by the way -- it's pretty fragile. I would have this be a component of the template itself.

Julz_James
Level 10

Re: Two 'pop-up' forms on one Marketo LP?

This is the URL I'm trying to put the forms on: Call Center Technology Leader | inContact

Thank you 🙂

Mark_Price
Level 7

Re: Two 'pop-up' forms on one Marketo LP?

It looks like the could be this:

src="//app-lon06.marketo.com/js/forms2/js/forms2.min.js"

When removing that, it looks to function (example)

<script>

var formPrefix = '#mktoForm_',

formLaunchers = document.querySelectorAll('BUTTON.mktoform-launcher'),

  arrayFrom = Function.prototype.call.bind(Array.prototype.slice);

arrayFrom(formLaunchers).forEach(function(el){

el.addEventListener('click', function(e) {

var formId = this.getAttribute('data-mktoform-id');

MktoForms2.loadForm("//app-lon06.marketo.com", "069-KVM-666", formId, function(form) {

MktoForms2.lightbox(form).show();

})

  return false;

  })

});
</script>

^ for some reason the code highlighter will not show the closing script tag.. so hopefully this is ok.

SanfordWhiteman
Level 10 - Community Moderator

Re: Two 'pop-up' forms on one Marketo LP?

Yes, quite so... the local script cannot have a src.

Mark_Price
Level 7

Re: Two 'pop-up' forms on one Marketo LP?

I thought so!  thx for confirming.  noted for next time