- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Embedded form function
SOLVEJul 1, 2019 8:55 AM
Is there a way to ensure that my method inside onFormSubmit has fully run before the forms redirect happens?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Accepted Solutions
Jul 10, 2019 1:39 PM
Hi @Siyabonga,
So far as I know, that's not possible. I believe the form redirect creates a new thread in the browser, which the callback functions don't have access to. There is some time before the redirect happens, so if you're running code that only takes a few milliseconds, the code should run I'd think. But if you're trying to do something that takes more time, like with timeouts or with promises, you could consider adding the redirect into your callback function. And then within the form editor, just select the inline thank you message option instead of the redirect.
You've probably seen our docs, but we have those callbacks and events documented here: https://developers.hubspot.com/docs/methods/forms/advanced_form_options and here: https://developers.hubspot.com/global-form-events.
If you're having trouble with a specific page, feel free to let me know and link it here.
Thanks,
Leland
Leland ScanlanHubSpot Developer Support |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content