Can we show hubspot form after successfully message send

forms

#1

Hello everyone,

I have added HubSpot form in my Html landing page. Is it possible to show the form and the success message in the same page? Currently, when after form submit if form success to send the message it hides the form and only shows the thank you message.

Added the case image below
== form===

== success message ===

one image show form and one after the success message.
but I want to show both form and success message after successfully submitted the message.

Can anyone help me in this?

Thank you in advance


#2

Hi @dghimire it looks like you would be most succesful by writing the form yourself in your HTML page.
then post to hubspot with AJAX as described below:

https://developers.hubspot.com/docs/methods/forms/submit_form_ajax

That being said, I'm sure you have specific reasons as to why this is required for your project,
but hiding the form after form submission is usually a feature that is requested in by designers in my workflow.

If you are set on using hubspot's form, you might find a workaround that works for your needs by experimenting the form embed code to potentially bring the form back after it has been submitted by loading the form again via the hbspt.forms.create() function in conjunction with the onFormSubmit callback. as in the example from the API Doc:

Example of running script when form submits    

hbspt.forms.create({
      portalId: '',
      formId: '',
      onFormSubmit: function($form) {
        // YOUR SCRIPT HERE
        } 
});