I currently have a hidden form which auto-submits upon page load using the following code:
<script src="//app-abXX.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_3023" style="display:none;"></form>
<script>
MktoForms2.loadForm("//app-abXX.marketo.com", "XX-XX-XX", 3023, function(form) {
// Add an onSuccess handler
form.onSuccess(function(values, followUpUrl) {
// Get the form's jQuery element and hide it
form.getFormElem().hide();
// Return false to prevent the submission handler from taking the lead to the follow up url
return false;
});
form.submit();
});
</script>
We use this form in conjunction with URL parameters to update fields on the fly for our website visitors based on their actions. Recently, we've started to notice that on one of our landing pages, due to this auto-submitting form, new records are being created for users that are already in our database causing a bit of a headache for our reporting since records are being duplicated.
Is there any way to stop the form above from auto-submitting if the email field is empty?
... View more