Hi is it possible to achieve a "multi-step" form through hubspot. The first part of the form would be the basics, First Name, Last Name, Work Email and Company Name. Once the user clicks "Next" we would ask them to fill in more details. If they leave before or after next we will capture their info and assign them to a lifecycle stage and if they finish the next step we will qualify them for a sales call. Is this possible, if so how can I achieve this? TYIA
Jul 31, 202012:03 AM - edited Sep 17, 202010:28 AM
Contributor
Multi Step Forms - Possible??
SOLVE
hey I don't know if anyone's still looking for a solution to this.
I wrote a how to + shared the code for creating 2 step forms.
However with this method you can chain any amount of forms if you want, it's just nicer to split the code into neat functions rather than what is done in the how-to.
Hi @thesnappingdog firstly, thanks for the code, it was precisely what I was looking for. Unfortunately, I can't get it to work in any Hubspot hosted pages using themes.
Two issues encountered:
Options variable already declared in chrome dev tools. Changing the javascript to options2 cleared it.
Couldn't find target container #multistep-form for HubSpot Form 5412a705-e3d9-461c-a114-02381dffc828. Not rendering form onto the page
I think issue 2 is due to the const target = '#multistep-form'; in the javascript. The ID generated by the theme appears to change on every refresh and I can't find a way to make the form id static.
You can see what I mean on the demo-multi-step-form I've created using the Atlas Theme in the marketplace.
Any help appreciated.
Setup:
3 forms added
1st form adds email, forms 2 and 3 email is hidden
all forms set to raw html
all forms show thank you message javascript source added to page using these instructions
Hopefully this gives you a pattern to easily decipher. I included mine in my CSS file. You can put this in your html with <style></style>, but that is not best practice and should be avoided.
1) i'm using the "old" method (not your generator) to use a multi (3) step form on my website. In some cases the last few days and weeks, the second form didnt send the hidden email - so hubspot recognized the form from a new contact and every workflows broke 😞
2) when i use your generator instead, it only works with "render as raw html" - but then the styling is broken 😞
Answering 2). I was able to style the generated multistep forms in my CSS using the ID selector and either the HTML elements and Hubspot classes. It is a little extra work, but worth having the multi-step feel.
I was looking into this yesterday as well, managed by build a working prototype locally.
Long story short I just create a new form in the old ones place with the "onSubmit" option in the embed code.
Then pass over the first forms values as hidden fields to the next one. That way I don't need to wait for hubspot to update the fields to the actual database.
The last one form then actually sends all of the info.
Still need to test it out on our actual website but looks promising and since it only needs some extra lines of javascript
This is the code that worked for me to make it 3-step. You only need to capture the email "onFormSubmit" once, and basically you swap a form "onFormSubmitted" after it's done. Like @thesnappingdog said though, you can probably break this up into functions to make it a little cleaner and expand the flexiblity.
I'm kind of a developer, but not really. (lol) So I'm wondering, how much do I have to worry about the data array index changing in the future? I know it's out of our control and Hubspot isn't going to send out a user-wide email, but if this custom code ever stops working, it might be difficult to catch.
Also, if someone quits halfway through the forms, I know we can send them a reminder email to come back and fill it out using the HS automations, but is there a way to send them to the exact step on the original page? Otherwise, the workaround is to create individual pages corresponding to individual steps. Then updating the embed code to only include the forms from that point forward.