CMS Development

matttunney
Top Contributor

Ajax like swap landing page content on form submission

SOLVE

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

0 Upvotes
1 Accepted solution
matttunney
Solution
Top Contributor

Ajax like swap landing page content on form submission

SOLVE

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
});

View solution in original post

2 Replies 2
Reg
Contributor | Elite Partner
Contributor | Elite Partner

Ajax like swap landing page content on form submission

SOLVE

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

Reg Desgroseilliers
www.rdcoding.com
matttunney
Solution
Top Contributor

Ajax like swap landing page content on form submission

SOLVE

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
});