SOLVED

Re: Pass the value of a form field to display on Wordpress Thank you page redirect

Go to solution
jehuty15
Level 1

Pass the value of a form field to display on Wordpress Thank you page redirect

Hi all,

I've created a guided landing page and have set to redirect to an external page after the form submission.

I'd like to pass the value of the FirstName field and then to render it on a Wordpress page with the message saying something like.


"Thank you, {FirstName} for getting in touch..."

Does anyone know if this is possible? I tried this tutorial here but it I couldn't get the value to append to the URL:

https://blog.teknkl.com/append-fields-to-thank-you-url/

 

Any help would be much appreciated! 

 

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Pass the value of a form field to display on Wordpress Thank you page redirect

Nothing wrong with the code in that post, it’s well tested.

 

What’s the URL of the page you tried this on?

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Pass the value of a form field to display on Wordpress Thank you page redirect

Nothing wrong with the code in that post, it’s well tested.

 

What’s the URL of the page you tried this on?

jehuty15
Level 1

Re: Pass the value of a form field to display on Wordpress Thank you page redirect

Hi @SanfordWhiteman Thank for your reply!

 

The code is good so I know my implementation/setup is causing the issue. 😅

 

This is my landing page here: https://you.oxfam.org.au/Test-first-name-variable.html
and for testing I've set up a redirect to https://www.oxfam.org.au/marketo-thank-you/ 

 

Your solution makes perfect sense but for the life of me I can't figure out what i'm missing to pass the values to the URL parameter. 

Sorry, i'm a bit of a newb with these marketo dynamic stuff.

 

Any help would be much appreciated 😃

SanfordWhiteman
Level 10 - Community Moderator

Re: Pass the value of a form field to display on Wordpress Thank you page redirect

Put the script just before the closing </body> tag. Right now you have it in the wrong place as it's trying to run before MktoForms2 is available, and erroring out as a result.
jehuty15
Level 1

Re: Pass the value of a form field to display on Wordpress Thank you page redirect

Thanks @SanfordWhiteman for looking into this. Really, appreciate all the help so far 😃

 

I moved the script just before the closing </body> tag but unfortunately, I can still can't get it to pass the values into the URL.


I added a console log to write after the onSuccess function to see the resulting URL string of the Thank you page.

 

mktoForm.onSuccess(function(submittedValues,thankYouURL){
   console.log("Thank You URL from Marketo:", thankYouURL);
.....
}

However, only the built-in "AlidID" query is added
Screenshot 2024-03-15 at 11.22.01 am.png

 

Not too sure what i'm missing 😅

 

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Pass the value of a form field to display on Wordpress Thank you page redirect

That’s just checking the value of the Thank You URL before it’s modified, i.e. the thankYouURLargument.

 

Naturally, it won’t have any additional query params added. In fact, the original arg is never modified.

 

Your problem is that you’re adding anotheronSuccess listener in a GTM-injected script:

SanfordWhiteman_3-1710487595677.png

 

You need to remove the eventCallback from that code because it’s taking precedence over the inline onSuccess.

jehuty15
Level 1

Re: Pass the value of a form field to display on Wordpress Thank you page redirect

Hey @SanfordWhiteman that makes sense.

 

I'll look to remove the eventCallback from the GTM inject script. 

 

Thanks again for your help. Much appreciated 😃

 

Update: It worked!