Re: Embed two marketo form into one page

Anonymous
Not applicable

Embed two marketo form into one page

Hi,

I embed two marketo form into a non-marketo page:

- Form 1:

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

<form id="mktoForm_1111"></form>

<script>MktoForms2.loadForm("//app-sjo.marketo.com", "XXX-PCT-XXX", 1111);</script>

- Form 2:

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

<form id="mktoForm_2222"></form>

<script>MktoForms2.loadForm("//app-sjo.marketo.com", "XXX-PCT-XXX", 2222);</script>

So, do i need to add <script src="//app-sjo.marketo.com/js/forms2/js/forms2.min.js"></script> twice on this page?

Thanks,

Lam

Tags (2)
10 REPLIES 10
Anonymous
Not applicable

Re: Embed two marketo form into one page

And it seems the form validation conflict with fields in 2 forms.

Ex: when i focus in the email field in form2, it jum to email in form 1 with the error tooltip?

SanfordWhiteman
Level 10 - Community Moderator

Re: Embed two marketo form into one page

You absolutely do not want to add forms2.min.js twice.

Alok_Ramsisaria
Level 10

Re: Embed two marketo form into one page

Adding 2 Marketo forms on a single landing page is not possible since it would cause a conflict of IDs. One option is to have a form on a landing page, and on click of the Submit button, we show another form as a pop-up in a lightbox. Two separate forms on a single MKTO or non-MKTO landing page are not possible.     

SanfordWhiteman
Level 10 - Community Moderator

Re: Embed two marketo form into one page

Alok, this is not true.  It's quite possible, there's no conflict. MktoForms2 :: Two forms, One page

Perhaps you are confusing this with having the same form twice on one page.

Alok_Ramsisaria
Level 10

Re: Embed two marketo form into one page

Sanford Whiteman This is helpful. Yes, I was assuming two same forms on a single landing page. Thanks for clarifying.

Ilana_Guilfoyle
Level 2

Re: Embed two marketo form into one page

I'm doing the same thing and am running into form validation issues. When a user submits one form, after submission the page scrolls to the other form with a different id and has all the fields highlighted. The original form does submit properly, but the user wouldn't know that based on this behavior (I have both forms set to keep the user on the page). Each of the forms are rendering with 2 submit buttons as well. There's no errors popping up in the console and i'm kind of at a loss. How were you able to avoid these bugs in your jsFiddle?

SanfordWhiteman
Level 10 - Community Moderator

Re: Embed two marketo form into one page

There aren't any tricks in the Fiddle (you can see all the JS).  What's your page URL?

Ilana_Guilfoyle
Level 2

Re: Embed two marketo form into one page

Is there a place i could email it to you directly, it's a staging url....

SanfordWhiteman
Level 10 - Community Moderator

Re: Embed two marketo form into one page