Re: How to copy the form code from a Marketo form to a template to implement custom javascript?

Anonymous
Not applicable

How to copy the form code from a Marketo form to a template to implement custom javascript?

I was told I need to copy the form code from my Marketo form to the template in order to implement javascript. This makes sense but I am not sure which part of the code needs to be copied. I see where the form is when I view the source but i also see a long <script> and <noscript> code underneath. Do I need to copy either of these? Here is my page with a Marketo form on it: http://preferences.discoveryco.com/manage. This form is currently set to dynamically populate based on the user's preferences, will this still work correctly if I copy the form code directly to the page?
Tags (1)
2 REPLIES 2
Justin_Cooperm2
Level 10

Re: How to copy the form code from a Marketo form to a template to implement custom javascript?

Hi Bethany,

Regardless of whether you are using an embedded form (you added a form to your own webpage using the form's embed code) or have simply added a form to a Marketo landing page via the landing page editor, you can manipulate the form with JavaScript by following the examples here: http://developers.marketo.com/documentation/websites/forms-2-0/

If you are still having trouble figuring out how to interact with the form in this way, please let me know. More than happy to help.
Josh_Hill13
Level 10 - Champion Alumni

Re: How to copy the form code from a Marketo form to a template to implement custom javascript?

I'm not sure why you would have to add the code to the Template. You can drag in a Custom HTML element on the Page and add the javascript that way. The form should modify its behavior according to the script.

If you wanted ALL page templates to have the same javascript, you can do that too by copying the

<SCRIPT>
CODE
</SCRIPT>

and pasting it into the Template.