Solved
Form onSuccess refreshes page
Hi,
I have this code that has a bug in it:
<div class="mktoForm" id="promoForm" mktoName="Promotion Form"></div>
<!-- Marketo Form Event Handler Must stay here to load with form-->
<script>
MktoForms2.whenReady((form) => {
form.onSuccess((values, followUpUrl) => {
form.getFormElem().hide();
document.getElementById('promoConfirmFormDiv').style.display = 'block';
return false;
});
});
</script>
<div id="promoConfirmFormDiv" style="display:none;">
<p class="text-white"><strong>${promoFormConfirmation}</strong></p>
</div>When I submit my form the page still refreshes. When I debug the code the return false is called twice for some reason and on the second call the page refreshes and I tried a few other options, but nothing has worked. Does anyone have any tips to try to assist me?
Kind regards,
Ethan