APIs & Integrations

LeoRebelatto
Participant

New HubSpot Form Builder – How to Trigger API Call and Redirect After Submission?

SOLVE

I'm integrating a HubSpot form with my app's trial registration. After the user submits the form, I need to make an API call, check the response, and redirect the user to a custom page based on the result.


With legacy forms, I could use form submission events to handle this. But with the new form builder, those events aren't triggering. How can I achieve the same behavior with the new form setup?

0 Upvotes
1 Accepted solution
evaldas
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

New HubSpot Form Builder – How to Trigger API Call and Redirect After Submission?

SOLVE

Hi @LeoRebelatto,

 

The new form builder now has a new set of global form events.

 

Here is a sample for listening for a successful form submission:

 

window.addEventListener('hs-form-event:on-submission:success', (event) => {
  console.log('User successfully submitted the form!');
});

 

Hope this helps!

✔️ Did this post help answer your query? Help the community by marking it as a solution.

View solution in original post

3 Replies 3
evaldas
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

New HubSpot Form Builder – How to Trigger API Call and Redirect After Submission?

SOLVE

Hi @LeoRebelatto,

 

The new form builder now has a new set of global form events.

 

Here is a sample for listening for a successful form submission:

 

window.addEventListener('hs-form-event:on-submission:success', (event) => {
  console.log('User successfully submitted the form!');
});

 

Hope this helps!

✔️ Did this post help answer your query? Help the community by marking it as a solution.

LeoRebelatto
Participant

New HubSpot Form Builder – How to Trigger API Call and Redirect After Submission?

SOLVE

Hey @evaldas,

This really helped, thank you so much!

evaldas
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

New HubSpot Form Builder – How to Trigger API Call and Redirect After Submission?

SOLVE

Awesome, glad to hear!

✔️ Did this post help answer your query? Help the community by marking it as a solution.

0 Upvotes