16 Replies Latest reply on Oct 19, 2016 6:14 AM by Chris Vandermarel

    Auto Submit Marketo Form on Page Load

    Derek Vansant

      I have a use case where I want a marketo form to pre-populate fields based on url parameters and then automatically be submitted on page load  without any user clicks. I would have thought the code below would work, but it doesn't. Instead, the code makes the page reload over and over again. If it matters, the page is a marketo landing page on a marketo server.


      Anyone ever tackle this use case before? Any ideas why the code below doesn't work?



      <div class="mktoContent">


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

      <form id="mktoForm_59"></form>

      <script>MktoForms2.loadForm("//app-sj11.marketo.com", "558-YIS-558", 59);</script> 



      <script type="text/javascript">

      function formAutoSubmit () {

      var frm = document.getElementById("mktoForm_59");



      window.onload = formAutoSubmit;