CMS Development

tezrosolutions
Member

Redirecting to a URL after form submission with form field inputs as query string parameters

Hi,

I have a form on a HubSpot landing page. When user submits the form, I want them to be redirected to a URL with form field inputs as query string parameters.


Do we have a way of doing it?

 

5 Replies 5
stefen
Key Advisor | Partner
Key Advisor | Partner

Redirecting to a URL after form submission with form field inputs as query string parameters

You could do this "by hand" pretty easily and if the page you are redirecting to is a HubSpot page you can use the "get" HubL function to use those variables as desired.

Here is a simple example:

<form action="//www.example.com/thank-you-page" method="POST">    
	First Name: <input name="firstName" type="text">
	<input type="submit" name="submit" value="send">
</form>

And then on the thank you page you could display those fields on the page with HubL like so:

<p>Thanks {{ request.query_dict.get('firstName') }}!</p>

Of course if you want to capture the contact's data you'll need to use the HubSpot API and dive a little deeper...

Stefen Phelps, Community Champion, Kelp Web Developer
mhoran
Member

Redirecting to a URL after form submission with form field inputs as query string parameters

Thanks for the thoughts on that!  The page we would be redirecting to would not be a hubspot page but I'm curious if I could manually enter the form action parameter to point to that page that is external to hubspot?  I didn't see any option in the form settings to control where it posted to and I would assume if it was posting somewhere external to hubspot that it would not be recorded then as being a completed form in hubspot.

 

Thanks, Mark

sunnyt7
Member

Redirecting to a URL after form submission with form field inputs as query string parameters

I'm also looking to accomplish this.

 

On our HubSpot-enabled Wordpress page, we have a form that has an email field and "Apply Now" button. After someone puts in their email and hits Apply Now, they get redirected to an external page with a longer form. I would like for that external form to utilize the email we just captured, but the form's Redirect URL would have to look something like: externaldomain.com/apply-now?email={{contact.email}}, and output externaldomain.com/apply-now?email=user@name.com.

Is there any way to do this?
Thanks!

relabidin
HubSpot Alumni
HubSpot Alumni

Redirecting to a URL after form submission with form field inputs as query string parameters

Hi @tezrosolutions,

 

HubSpot does not offer a feature that allows you to pass form submission data onto the redirect URL as query string parameters. 

 

Can you tell me a little bit more about what you are trying to do with those form field inputs? Depending on your goal, you can use our Forms API to pass that form data over to where it needs to be.

 

Rami 

mhoran
Member

Redirecting to a URL after form submission with form field inputs as query string parameters

I would be interested in the same functionality and it would be to allow for actions to happen in an outside system based on the form that was submitted in hubspot.  It seems that with the Forms API the order of this would need to be flipped and called from another system rather than having the URL hit after hubspot accepted the form but maybe there is something else in the Forms API I'm not aware of.  Since you already have a redirect feature to a URL for the form submission it would just be the inclusion of the form fields as query string parameters that would be needed.

 

Thanks, Mark