12 Replies Latest reply on Jul 23, 2017 1:07 PM by Sanford Whiteman

    Hidden Marketo Forms Conflict on Wordpress

    Nick Pietro

      Our Wordpress site has several different forms (Gravity Forms) and we just started using Marketo so I've been attempting to integrate a couple with Marketo using just an embedded hidden form, then following their documentation to map the Gravity Form fields and push the data to Marketo on submission. A couple adjustments were made based on some threads on here but the problem is that the Marketo JS seems to conflict with the Gravity Form/Wordpress submission handling.

       

      If the Marketo script to map and submit is on the page, the data will push to Marketo. However the Gravity Form confirmation action doesn't happen. IE if the form is supposed to redirect, or display a confirmation message that doesn't happen. The form/page just refreshes. Is this due to the Marketo.submit() function refreshing the page?

       

      I'm not getting any javascript errors and can't really figure out what else is going on. The map/submit script I'm using is below

       

      <script src="//app-sj19.marketo.com/js/forms2/js/forms2.min.js"></script>

      <form style-"display:none!important;" id="mktoForm_1007"></form>

      <script>

      MktoForms2.loadForm("//app-sj19.marketo.com", "555-555-555", 1007, function(form) {

        var marketoForm = MktoForms2.allForms()[0];

        jQuery("form#gform_24").submit(function(){

          marketoForm.addHiddenFields({

           //Marketo Field Mapping

        "FirstName": jQuery("#input_24_1").val(),

        "LastName": jQuery("#input_24_2").val(),

        "Email": jQuery("#input_24_3").val(),

        "Company": jQuery("#input_24_6").val(),

        "businessChallenges": jQuery("#input_24_4").val(),

        });

             marketoForm.submit();

           });

        });

       

       

      </script>