Created
August 15, 2024 19:41
OM Custom Marketo form example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="//app-aba.marketo.com/js/forms2/js/forms2.min.js"></script> | |
<form id="mktoForm_#####"></form> | |
<script> | |
MktoForms2.loadForm("//app-aba.marketo.com", "###-LLL-###", #####, function(form) { | |
var formEl = form.getFormElem()[0]; | |
var submitEl = formEl.querySelector('button[type="submit"]'); | |
form.onSuccess(function(values, followUpUrl) { | |
// Get the form's jQuery element and hide it | |
form.getFormElem().hide(); | |
// Trigger a conversion of the form | |
om{{id}}.Listeners.convert(); | |
// Show Success view | |
// Remove if you prefer to close the campaign or redirect on submission | |
om{{id}}.changeView('success'); | |
// Close the campaign | |
// Remove if you prefer to show the success view or redirect on submission | |
om{{id}}.startClose(); | |
// Return false to prevent the submission handler from taking the lead to the follow up url | |
// Remove if you want to redirect the visitor as configured in the Marketo form builder | |
return false; | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment