New to hubspot, having some issue with the “Thank you message or page redirect option” on the form.
I want to Redirect to another page after a visitor submits the form.
I want to add a link to another page on our website, but I want to pass the information I collected on the form as a parameter.
Let’s say:
https://example.com/custom-thank-you/
So what I want to do is:
https://example.com/custom-thank-you/?param1=firstname¶m2=lastname
Assuming I’ve collected “firstname” and “lastname” in the form they are submitting.
I’ve tried the field name, I’ve tried {field name} and {{field name}}. The test URL just sends whatever I put in there.
How do you reference the form fields, I did try {form.field name} as well, please help.
Hi, @DDutchyn
You are correct, HubSpot’s form redirect options do not support dynamic variables to be added in the redirect URL. Nor is this something you can do directly in the form settings in HubSpot.
You’d likely need to use JavaScript to capture the form submissions, then build and execute the redirect manually. This would require some custom code on the page where your form is located.
Additionally, don’t to consider privacy implications as personal data would be visible in the URL parameters. Make sure your method is compliant with your local privacy laws and regulations.
Best,
Jaycee
Hi @DDutchyn
Sure, I can help you with that.
To reference the form fields in the redirect URL, you can use the following syntax:
{form.field_name}
For example, if your form has a field named “firstname”, you would use the following syntax in the redirect URL:
https://example.com/custom-thank-you/?param1={form.firstname}
You can also use the following syntax to reference multiple form fields in the redirect URL:
https://example.com/custom-thank-you/?param1={form.firstname}¶m2={form.lastname}
If you are using HubSpot CRM, you can also use the following syntax to reference form fields that are associated with CRM contacts:
https://example.com/custom-thank-you/?param1={contact.firstname}¶m2={contact.lastname}
I hope this helps! Let me know if you have any other questions.
Here are some additional tips for redirecting to another page after a form submission:
* You can use the onFormSubmit event to redirect to another page after a form is submitted.
* You can use the redirectUrl property to specify the URL that you want to redirect to after a form is submitted.
* You can use the inlineMessage property to display a message to the user after a form is submitted.
Hope this will helps you out. Please mark it as Solution Accepted to help other Community member.
Thanks!
Hi,
I followed your example and it doesn’t work, the fields are not replaced.
Are you sure this method works?
¶m1={contact.email}¶m2={contact.firstname}&submissionGuid=