SOLVED

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

6 REPLIES 6
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>.

View solution in original post

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.

Anonymous
Not applicable

Re: Embedded Forms 2.0 Duplicating in Drupal

This worked, thank you @Sanford!