I recently set up a hubspot form which I embed on my website using the provided html code. When the form is set to display a “thank you” message once a user hits submit, it works fine - the form is submitted and the “thank you” message is displayed.
If I instead configure the form to forward the user to a URL once they submit the form, the process breaks. Specifically, the user his “submit” and nothing happens. No redirect. It’s as if the page just freezes. I do recieve the submission, so it’s something specific to the redirect that is not working.
The site I’d like the form to redirect to is https://www.sugarmommascookies.com/order-form-ty - I’ve confirmed this link is active, and that is is typed exactly as is in the form option to redirect as shown below:
Thanks so much for the response. The site would be www.sugarmommascookies.com/order-form - You can fill out and submit the form on there, but you will notice that it seems to just freeze if you hit submit.
Ok, this one is tough to explain and probably even tougher to fix.
Godaddy builder does some insane things to code and this is no exception.
Your hubspot form is in an iframe and when you submit the form, the embed code tells the parent of the iframe (which would be your browser window that encompasses your whole webpage including the iframe) to redirect to a different page… however, since godaddy is putting your form (iframe) inside of another iframe, when the form submits, it’s telling the parent 1iframe instead of the parent of the parent (parent #2) of the iframe, to do the redirect.
Hi there! Just wanted to thank you for your detailed explanation. i’m still debating my options to solve it, but your help at least helped me understand the issue. Thank you!
Our issue was with wix, the form submitted but the thank you page was embedded in an embedded iframe. we had to add an onFormSubmit Handler to target the top window object for the redirect:
thanks for your code! I edited the portalID, formID and my url to match the form code I got from Hubspot. I added to WIX as custom code in the body of the respective page (and tried as well to add it to the header). But the thank you page is still showing in the iframe. Am I putting the code to the wrong place?
Help would be much appreciated!
As I can see, it seems that there is a problem with the way you embedded the form. I checked the page HTML source code and I saw a form inside another form.
Can you share the embed code you used to publish the form?
I really appreciate the response. That sounds in line with something I read about “a frame being within a frame” and that not being allowed to be redirected for security reasons. I’d be really interested in your thoughts on the code below:
I have the exact same problem. Trying to redirect my embedded form after submit. I actually created a CodePen to try and get it resolved (to no avail): https://codepen.io/antonylyfta/pen/NWwEZLM
My form submits (I receive the submission), but the page does not redirect (INCEPTION!).
It would be really great for the Community if somebody could find a (least bad) solution to this problem. I am eager to use HubSpot forms - but without additional control over the data my options are severely limited.
Hi @GFusco, I’m encountering the exact same issue on Wix as my contact form is embedded in an iFrame and therefore the thank you page I’d like to redirect to (for tracking purposes) is only loaded within the frame.
Hey I ran into the same issue and this is the fixed form I had just put your embed code into chatgpt and ask it to turn yours into the same as mine.
<script charset=“utf-8” type=“text/javascript” src=“//js-na2.hsforms.net/forms/embed/v2.js”></script>
<script>
hbspt.forms.create({
portalId: “242003643”,
formId: “6f55d8b5-9a79-42e8-85ca-2b3a1ba6a4a7”,
region: “na2”,
onFormSubmitted: function($form) {
window.top.location.href = “https://tradeaid.io/video”;
}
});
</script>