Passing Variables on Landing Page into FORMS


#1

I am looking for a way to pass an email address that is stored in a variable into a Hubspot form so that the user of the form only needs to verify that the email address is correct and then click the submit button. From this point Hubspot will load the user email address into the Hubspot database and a tracking cookie will be placed on the users device.


#2

Hi @cmackin,

There are several ways to do this. You can use a query parameter to pre-populate the form ?email=test@test.com.

Another way would be, if you had access to the embed code, you could do something like this:

hbspt.forms.create({
	portalId: '',
	formId: '',
	onFormReady: function($form) {
		$('input[name="email"]', $form).val( YOUR_EMAIL_VARIABLE );
	} 
});

Other than these, the only other way that I can think of would be to have some sort of time delay before populating the field, but I don’t believe this would not be very reliable because of some peoples internet and the lag of the form rendering.

Thanks