AnsweredAssumed Answered

Where to Embed Form API JavaScript in a Guided Landing Page Template

Question asked by Will Raleigh on Nov 10, 2018
Latest reply on Nov 10, 2018 by Sanford Whiteman

I'm trying to interrupt form validation so I can check to see if the values of all submitted fields are less than or equal to the value of a hidden field.

 

I found the Forms API here: http://developers.marketo.com/javascript-api/forms/

 

If I add their code samples to my guided landing page template outside of the form div, (whether in the head or the body) the fields of the form are duplicated (strangely they're duplicated within the form div even though the JavaScript is not being put in that area of the page, so it's like two versions of the form are stacked on top of each other.

 

If I add the code sample within the form div, I only see the fields once, but it looks like my custom code is not being invoked and the selection of a form on the landing page is overriding what I embedded on the page. If I don't select a form on the landing page, nothing shows up.

 

Where should I be putting this code on a guided landing page template, or is there a line of code I need to add or remove from the javascript to prevent the form loading twice?

 

For reference and ease of testing right now I'm just using a straight copy and paste of the "Read Form Values on Form Submit" example on this page (with changes made to use my munchkin code and form id):

http://developers.marketo.com/rest-api/assets/forms/examples/

Outcomes