Embedded Forms 2.0 Duplicating in Drupal | Community
Skip to main content
March 11, 2015
Solved

Embedded Forms 2.0 Duplicating in Drupal

  • March 11, 2015
  • 4 replies
  • 3801 views
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?

 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman
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>.

4 replies

March 18, 2015
This worked, thank you @Sanford!
SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
March 12, 2015
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>.
New Participant
April 16, 2020

@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
New Participant
April 16, 2020

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

March 12, 2015
Here is a sample page: test-a10.gotpantheon.com/en/node/11
SanfordWhiteman
New Participant
March 11, 2015
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?