Issue with Javascript on Page | Community
Skip to main content
Level 4
August 29, 2025
Solved

Issue with Javascript on Page

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.

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
August 29, 2025

JavaScript names are case-sensitive.

2 replies

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
August 29, 2025

JavaScript names are case-sensitive.

Translate
kenmckownAuthor
Level 4
August 29, 2025

That is what I thought the issue was as well, thanks for confirming.

Translate