Last active
April 25, 2022 19:27
-
-
Save thesnappingdog/44e470c160e13d3208ad5cf613027a47 to your computer and use it in GitHub Desktop.
Two-Step form in HubSpot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>2 Step Form</h1> | |
<div id="demo-form"></div> | |
<script charset="utf-8" type="text/javascript" src="https://js.hsforms.net/forms/v2.js"></script> | |
<script> | |
var data = [] | |
hbspt.forms.create({ | |
portalId: "YOUR_PORTAL_ID_HERE", | |
formId: "STEP_ONE_FORM_ID_HERE", | |
target: "#demo-form", | |
onFormSubmit: function(form) { | |
var incoming = $(form).serializeArray(); | |
data.push(incoming); | |
}, | |
onFormSubmitted: function(form) { | |
$('#demo-form').empty(); | |
hbspt.forms.create({ | |
portalId: "YOUR_PORTAL_ID_HERE", | |
formId: "STEP_TWO_FORM_ID_HERE", | |
target: "#demo-form", | |
onFormReady: function(form) { | |
form.find('input[name="email"]').val(data[0].value).change(); | |
} | |
}) | |
} | |
}); | |
</script> |
Hi, how can we add a progress bar in this multi step form?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great thanks and have a sunny day!