SOLVED

Re: Route form fill to specific thank you page based on the URL

Go to solution
shilohpaul
Level 2

Re: Route form fill to specific thank you page based on the URL

Oh my goodness - thank you! What a silly mistake that I won't be making again. It's working perfectly now! 

SanfordWhiteman
Level 10 - Community Moderator

Re: Route form fill to specific thank you page based on the URL

OK, great!

shilohpaul
Level 2

Re: Route form fill to specific thank you page based on the URL

Hi again! I asked this in another threat but it might be better to ask it here. 

Is there any way to get this to open in a new tab? 

SanfordWhiteman
Level 10 - Community Moderator

Re: Route form fill to specific thank you page based on the URL

Answered on the other thread. 

kenmckown
Level 4

Re: Route form fill to specific thank you page based on the URL

@SanfordWhiteman I found this and was attempting to use it on our instance, but it is causing issues. I am not sure if I broke the code trying to compile it. I am getting two forms showing up.

 

<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);</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>

<script>
MktoForms2.loadForm("//go.autoshopsolutions.com", "180-DGD-014", 3948, function(form){
  form.addHiddenFields({ LastFormURL : document.location.href })    
});
</script>

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Route form fill to specific thank you page based on the URL

That code contains a call to loadForm(). If you’re already calling loadForm() elsewhere, that’ll naturally create a duplicate form. It’s not an issue with the code, just a consequence of not coordinating with existing code.

 

Also not clear what you’re trying to do: that code doesn’t change the Thank You page.

kenmckown
Level 4

Re: Route form fill to specific thank you page based on the URL

The goal was to embed this form on an external page, the second part is to allow for changing the submit button, and the bottom piece was designed to change the Thank You page based on the LastFormURL field. I set up the choices on the form in Marketo.