Lead Capture Tools

tdodge
Participant

Page Redirect After Successful Form Completion - Collected Forms

SOLVE

Hi there,

 

I made the very expensive mistake of having a javascript redirect and the collected forms snippet tied to the submission button on my form. Apparently you can't have any other scripts associated with the button.

 

How do I perform a redirect if I can't use custom javascript on the button? I'd like to at least acknowledge the customer for completing the form.

 

Any help would be appreciated.

0 Upvotes
1 Accepted solution
relabidin
Solution
HubSpot Alumni
HubSpot Alumni

Page Redirect After Successful Form Completion - Collected Forms

SOLVE

Hi @tdodge,

 

I did a little research on JavaScript form redirects and I found this Stackoverflow article that might be helpful: http://stackoverflow.com/questions/24140727/redirecting-after-form-submit

 

Apparently, you can add the destination URL to the Action in the form tag to have it redirect post submit without targeting the submit button directly.

<form id="yourForm" action="redirectURLGoesHere">
</form>

Rami 

View solution in original post

3 Replies 3
relabidin
Solution
HubSpot Alumni
HubSpot Alumni

Page Redirect After Successful Form Completion - Collected Forms

SOLVE

Hi @tdodge,

 

I did a little research on JavaScript form redirects and I found this Stackoverflow article that might be helpful: http://stackoverflow.com/questions/24140727/redirecting-after-form-submit

 

Apparently, you can add the destination URL to the Action in the form tag to have it redirect post submit without targeting the submit button directly.

<form id="yourForm" action="redirectURLGoesHere">
</form>

Rami 

agdupz
Member

Page Redirect After Successful Form Completion - Collected Forms

SOLVE

Hi Rami,

 

I have a similar issue, maybe you can help me as well?

 

I have a landing page with a form, after submit is pressed it should run the Collected Form script, send the data to HS, and then redirect to "thanks" page.

 

My problem is that when I set the action in the form tag as above, the page redirects successfully but the form data is not picked up. Strangely enough, if I then go back to the original landing page (via "back" or refresh) the form data is then sent to HS.

 

Without the action in the form tag, the data is picked up but the page doesn't redirect after submit. Every attempt to put the redirect elsewhere in the page code (whether via button action, onclick method, or additional JS) just doesn't trigger.

 

Thanks in advance!

 

 

0 Upvotes
tdodge
Participant

Page Redirect After Successful Form Completion - Collected Forms

SOLVE

Hey @relabidin,

 

Thanks for the response and please accept my apologies for how long it's taken me to do so. I ended up finding the same work around as you and it works beautifully.

 

Thanks so much!