It was working great, but recently, I am no longer able to capture the redirectURL value of the contextObject. It seems like the page redirects before I have a chance to. While the form is visible, I can see the value of redirectURL in hs_context, but like I said, the function Teun gave me doesn't seem to capture it in time (like it used to).
If anyone can help me out, the form is the one that pops up when clicking "Get Your Personalized Report" button on this page:
Intercepting a Hubspot form submission and adding parameters to the redirection URL
SOLVE
I'm home for the holidays so forgive me for not double checking here but I'm almost certain I got around this on a clients site recently by setting the response_redirect_id to blank like:
Intercepting a Hubspot form submission and adding parameters to the redirection URL
SOLVE
Sorry for not responding earlier. Thanks for the help!
Shouldn't this instead be kept open? While @BarryGrennan has a work around, isn't this still broken? If anyone needs to embed a form into module with the "snippet", and has need for the redirect url on submission, will they need to edit the snippet each time?
I would like to please know if this is a bug and if it is backlogged for fixing. Thank you!
Intercepting a Hubspot form submission and adding parameters to the redirection URL
SOLVE
I'm home for the holidays so forgive me for not double checking here but I'm almost certain I got around this on a clients site recently by setting the response_redirect_id to blank like:
Doesn't seem like it should have anyeffect on the global event listener but maybe it's an unforseen bug? Other events for the listener work fine, it's just with onFormSubmit that the form no longer seems to effectively catch changes made using the listener.
If this answer solved your question, please mark it as the solution.
Dec 16, 202210:13 AM - edited Dec 16, 202210:14 AM
Recognized Expert | Elite Partner
Intercepting a Hubspot form submission and adding parameters to the redirection URL
SOLVE
Yea, recently it seems like the global event listener has stopped working to make changes to a form on submission. We had some modules that broke due to this exact reason. The only solution was to switch to using a form embed code and moving all the code into the callback there.
@Jaycee_Lewis You wouldn't happen to have any insight into wether HubSpot has changed something with forms this year that could have caused this break?
If this answer solved your question, please mark it as the solution.
Intercepting a Hubspot form submission and adding parameters to the redirection URL
SOLVE
Hi, @alyssamwilie, My source of truth for updates is the Changelog — Forms API. If the changes from earlier in 2022 are unrelated to what you're experiencing, I am happy to collaborate and do a bit of investigation on my own.