AnsweredAssumed Answered

Background submission not working on Windows browsers

Question asked by Bruce Bailey on Apr 2, 2019
Latest reply on Apr 2, 2019 by Sanford Whiteman

I have the background submission code working on a Mac... works great on all browsers.  Had a few users test it on Windows and it won't work on any browser on a Windows machine, but continues to work on OSX.  Can anyone see what I have in here would not be Windows friendly? I put some alerts in to test and it does not appear to be even firing this code.

 

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

<script>

MktoForms2.loadForm("//app-ab15.marketo.com", "110-GBK-123", 1081);

MktoForms2.whenReady(function(mktoForm) {

   

  $('.form-submit').click(function(){$(customFormData.formSelector).submit();});

  var customFormData = {

    formSelector : '#frm35F472E0-96B1-3589-E76F56B84176EDBD',

    fieldMap : [

    {

      marketo : 'FirstName',

      custom : '#field-firstname'

    },   

      {

      marketo : 'LastName',

      custom : '#field-lastname'

    },  

      {

      marketo : 'Email',

      custom : '#field-email'

    },

               {

      marketo : 'Company',

      custom : '#field-company'

    }

                

               ]

  }

 

$(customFormData.formSelector).submit(function(e) {

    var customForm = e.target,

        mktoFields = {};

             

    // iterate over fields on custom form to create MktoForms-compat object

    customFormData.fieldMap.forEach(function(field){

      mktoFields[field.marketo] = customForm.querySelector(field.custom).value

    });

     

    // add to Marketo form

    mktoForm.addHiddenFields(mktoFields);

    // submit Marketo form

    mktoForm.submit();

    // stop custom HTML form submission

    e.preventDefault();

 

  });

});

 

</script>

Outcomes