AnsweredAssumed Answered

How can I isolate or embed a form without having code collisions?

Question asked by 97309bcf46083209a03e96094304b8e5241935a9 on Nov 17, 2016
Latest reply on Nov 17, 2016 by sanford.whiteman

We have embedded a form in our WordPress web site using the following code:

<script src="//app-sjxx.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_xxxx"></form>
<script>MktoForms2.loadForm("//app-sjxx.marketo.com", "xxx-xxx-xxx", xxxx);</script>

Once embedded, the form works okay; however WordPress will no longer allow us to edit its parent object.  It seems there's a code collision happening - perhaps a variable used by Marketo is the same name and scope as in WordPress.

 

Is there a way I can wrap the code above with JavaScript to isolate the code imported by the script reference?  Is there a WordPress plugin for this perhaps?  Thanks in advance for the help.

Outcomes