Ajax like swap landing page content on form submission

SOLVE
Top Contributor

How can I go about detecting when a form has been submitted on a landing page. This is so I can trigger change the content?

 

This might be replacing the submitted form or call to action with new content.

 

Is there a form javascript event I can listen for?

 

I'm currently using a the form module.

 

Thanks

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Top Contributor

I found a solution that looks for a particular event to take place here:

https://integrate.hubspot.com/t/how-to-track-form-submission-events-in-javascript/1741/2

 

$('.hs_cos_wrapper_type_form').on('hsvalidatedsubmit', '.hs-form', function (e) {
    //do something
});
2 Replies 2
Highlighted
Reg Regular Contributor | Diamond Partner
Regular Contributor | Diamond Partner

Hi Matt,

 

It looks like you need to call the onFormSubmit callback. You can view the documentation here: https://developers.hubspot.com/docs/methods/forms/advanced_form_options

 

Cheers,

Reg

Top Contributor

I found a solution that looks for a particular event to take place here:

https://integrate.hubspot.com/t/how-to-track-form-submission-events-in-javascript/1741/2

 

$('.hs_cos_wrapper_type_form').on('hsvalidatedsubmit', '.hs-form', function (e) {
    //do something
});