Hi, If anyone looks to create a 2-page form using Hubspot, this is the solution for this, the only down side the this script is that must to ask for the email on the first page form:
<script charset="utf-8" type="text/javascript" src="//js-eu1.hsforms.net/forms/embed/v2.js"></script>
<script>
hbspt.forms.create({
portalId: "test****",
formId: "test****",
onFormSubmit: function($form){
var email = $form.find('input[name="email"]').val();
window.location = "URLHERE?email=" + encodeURIComponent( email);
}
});
</script>
Steps:
1- Create two pages that you want to link to each other.
2- Make sure you ask for the email address on the first form because you will get that variable (value) on the link of the second form.
3- Make sure you add the ‘HIDDEN FIELD’ Email on the second page (form) to get that synchronized between the two pages.
Very Important Note:
THIS SOLUTION IS ONLY FOR PEOPLE WHO WANT TO CREATE ONLY 2 PAGES AND THEY MUST ASK FOR THE EMAIL ADDRESS ON THE FIRST-PAGE FORM TO SUCCESSFULLY LINK THE TWO PAGES TO EACH OTHER.
My Message To The Hubspot Developers Nerds: I want to upgrade this code to make it flexible for other people because not all the people have Hubspot Developers backgrounds, I still have some questions about the script, can you please help me?
My questions:
1- What if the person if he has 3 or 4 forms how he could do it with the script above?
2- How we could take multiple variables (values) with the email, like name, last name, country, and phone number?
3- In the script that I have is to take the email variable (value) only, but in some form, it doesn’t ask for the email, is there any alternative solution for this, like taking another (variable) or (value)?
Guys, I really appreciate it if you could edit directly the code above the questions in this way everyone could benefit from it and at the same time it will be clear as well, I’m counting on you, Thank you So Much For Your Help.
