Skip to content

Instantly share code, notes, and snippets.

@cougrimes
Created October 20, 2017 20:41
Show Gist options
  • Save cougrimes/20fb7dbccb808cf91f4b18dec98b5764 to your computer and use it in GitHub Desktop.
Save cougrimes/20fb7dbccb808cf91f4b18dec98b5764 to your computer and use it in GitHub Desktop.
Show message on same page after successful form submission.
<div class="container">
<script src="//app-abc.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_27"></form>
<script>MktoForms2.loadForm("//app-abc.marketo.com", "123-ABC-456", 1);</script>
<div id="confirmation" aria-hidden="true" style="display:none;">
<p>This is a sample thank you message. Thanks for viewing.</p>
</div>
</div>
<script>
MktoForms2.whenReady(function (form){
form.onSuccess(function(vals, page){
form.getFormElem().hide();
var confirm = document.getElementById('confirmation');
confirm.style.display = 'inline-block';
confirm.setAttribute('aria-hidden', false);
return false;
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment