Refresh form without refreshing the page

benji_thecroc
Contributor | Gold Partner

Hi,

 

We have a couple of form modules that currently display an inline message after submission.

 

I was wondering if there was a way to reload the form to it's original state on a button click?

 

In our template a user can fill out the form and then click through to a different screen state where the form is hidden, ideally we'd want to form to reload at this point and be submittable again btu I don't think there's a way to do this without refreshign the page. I considered setting the form up so that it redirects to the page but with a # in the URL and fire a function to dynamically put the user back to the relevant screen state btu I can't do this.

 

Thanks,

Benji

0 Upvotes
1 Reply 1
valerajoey
Participant

hey Benji,
I have two solutions that you can try. 
First one needed you to set up a server, the Idea is to create a separate form from scratch. and hitting the submit button will first send its data to HubSpot via API, the next function will it's up to you. You can clear its field content or you can create a preloader and just refresh the form.

The second solution is, creating the form through form embed, 
    hbspt.forms.create({
                         portalId: '',
                         formId: '',
                         onFormSubmitted: function($form) { // YOUR SCRIPT HERE }
});

and after submitting try creating a new HubSpot Form. make sure you are using the inline message. 
I'm not sure if this will work though, but worth a try.