SOLVED

Re: Embedded Forms 2.0 Duplicating in Drupal

Go to solution
Anonymous
Not applicable

Embedded Forms 2.0 Duplicating in Drupal

Has anyone run into the issue when embedding a form on Drupal7, that the form appears without the custom CSS, and it is duplicated on the page?  If so, what was the fix?0EM50000000SzA4.jpg

 
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Embedded Forms 2.0 Duplicating in Drupal

OK, found it after some hunting.

Your jQuery "mmenu" plug-in duplicates the Marketo form... if it runs after the Marketo Forms 2.0 has been rendered.

Solution: Render the Marketo form after the mmenu is finished.  Put the Marketo code at the end of this block:

$(document).ready(function() {
var $mmenu_right = $("#mmenu_right");
       
...

MktoForms2.loadForm("//app-sjn.marketo.com", "417-GUB-995", 1442, function(){
jQuery('form#mktoForm_1442').addClass('munchkin-processed');
});

}(jQuery))

Also make sure the Marketo <SCRIPT> tag is in your <HEAD>.

View solution in original post

8 REPLIES 8
SanfordWhiteman
Level 10 - Community Moderator

Re: Embedded Forms 2.0 Duplicating in Drupal

Wow, pretty cool.  Kidding, but... I would assume the code is literally running twice and/or there are two identical container DIVs (which is actually not allowed in HTML standard but it may cause this kind of screwup).  What's the URL?
Anonymous
Not applicable

Re: Embedded Forms 2.0 Duplicating in Drupal

SanfordWhiteman
Level 10 - Community Moderator

Re: Embedded Forms 2.0 Duplicating in Drupal

OK, found it after some hunting.

Your jQuery "mmenu" plug-in duplicates the Marketo form... if it runs after the Marketo Forms 2.0 has been rendered.

Solution: Render the Marketo form after the mmenu is finished.  Put the Marketo code at the end of this block:

$(document).ready(function() {
var $mmenu_right = $("#mmenu_right");
       
...

MktoForms2.loadForm("//app-sjn.marketo.com", "417-GUB-995", 1442, function(){
jQuery('form#mktoForm_1442').addClass('munchkin-processed');
});

}(jQuery))

Also make sure the Marketo <SCRIPT> tag is in your <HEAD>.
Bonnieliu
Level 1

Re: Embedded Forms 2.0 Duplicating in Drupal

@SanfordWhiteman Thanks for sharing this!

Curious, is this still working for you. Not sure if anything has changed since 2015, but our developer didn't find this solution to work in Drupal today. Do you have any other suggestions or ideas of what we can try to resolve to the duplication of forms in Drupal?

SanfordWhiteman
Level 10 - Community Moderator

Re: Embedded Forms 2.0 Duplicating in Drupal

You'd have to provide your page. And pls open another thread in Products, this is way too old.

Akhila1994
Level 1

Re: Embedded Forms 2.0 Duplicating in Drupal

HI Sanford, 

I have embedded Form 2.0 in the WordPress page, but it was duplicating.

The same form I have used on different pages in WordPress there is working fine.

Akhila1994_0-1662600404123.png

Can you please suggest how this can be solved

SanfordWhiteman
Level 10 - Community Moderator

Re: Embedded Forms 2.0 Duplicating in Drupal

Please open a new thread and provide your URL.
Anonymous
Not applicable

Re: Embedded Forms 2.0 Duplicating in Drupal

This worked, thank you @Sanford!