AnsweredAssumed Answered

Auto Submit Marketo Form on Page Load

Question asked by Derek Vansant on Dec 14, 2015
Latest reply on Oct 19, 2016 by Chris Vandermarel

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="//"></script>

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

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



<script type="text/javascript">

function formAutoSubmit () {

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



window.onload = formAutoSubmit;