APIs & Integrations

Indra
Guide | Elite Partner
Guide | Elite Partner

Manipulate form script jQuery on hubpot page

Hi all,

I'm trying to manipulate a HubSpot form that is within a HubSpot page.
The manual on the developers website of HubSpot is only for a embed code and not for the HubSpot page forms.
(reference: https://developers.hubspot.com/manipulating-forms-with-jquery)

How can I manipulate a existing HubSpot form with jQuery like the code below without creating it? If posible, I don't want to embed the custom code script manually on the page on that place and still want to use the form selector within HubSpot.

hbspt.forms.create({ 
    portalId: 'XXXXXX',
    formId: 'aa8b5b4a-62ac-461b-a387-XXXXXXXXXXX',
    onFormReady($form, ctx){
   		$('input[value="checkbox_1"]').prop('checked', true).change();
    	$('input[name="firstname"]').val('Brian').change();   
   	}
});

Vet Digital - The Growth Agency | HubSpot Solutions Partner Agency

Did my post solve your question? Help the community by marking it as a solution
0 Upvotes
1 Reply 1
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Manipulate form script jQuery on hubpot page

Hi @Indra,

It's not currently possible to do that with a form built into a HubSpot page, but you could add some custom Javascript to listen to the global form events instead:

Using Global Form Events

This is a list of global events triggered by HubSpot forms; you can use these to trigger custom javascript related to forms. If you need complete control over the styles and actions of your form, you will still want to use the Forms API.

0 Upvotes