We have an external LP that has a Marketo form on it. We have custom JS on the page that is redirecting depending on a field that is written, but I noticed the field is no longer writing, even though the submission is telling it to. Not sure what happened, as it worked before.
This is the JS code:
<script src="//go.autoshopsolutions.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_3948"></form>
<script>
MktoForms2.loadForm("//go.autoshopsolutions.com", "180-DGD-014", 3948, function(form){
// Add hidden field
form.addHiddenFields({ lastFormURL : document.location.href });
// Override redirect on success
form.onSuccess(function(values, followUpUrl){
// Custom redirect URL
window.location.href = "https://shopboss.net/thank-you/?source=unbounce";
return false; // prevent default redirect
});
});
</script>
<script>
{
const ctaText = "Download Now";
/* -- NO NEED TO TOUCH BELOW HERE -- */
MktoForms2.whenReady(function(readyForm){
const formEl = readyForm.getFormElem()[0],
buttonEl = formEl.querySelector(".mktoButton[type='submit']");
buttonEl.textContent = ctaText;
});
}
</script>
I checked activity and it appears it is creating a new field, instead of updating the current one:
The field in Marketo should be this one:
I am wondering if the code just needs to be updated to lastFormUrl to map to the field on the form.
Solved! Go to Solution.
JavaScript names are case-sensitive.
That is what I thought the issue was as well, thanks for confirming.