APIs & Integrations

Annie-L
Participante

Integrating custom code into forms

resolver

Hi, 

 

I'm trying to integrate a custom code into a form I made but can't seem to find out where to add the code. The code needs to be linked to a hidden form field to capture a unique shortcode from the URL and campaign ID associated with the URL. 


I know this is possible because I have heard of people doing this on Hubspot but can't seem to figure out how. 

0 Avaliação positiva
1 Solução aceita
WendyGoh
Solução
HubSpot Employee
HubSpot Employee

Integrating custom code into forms

resolver

Hi @Annie-L,

 

I hope all is well with you 😄

 

Are you looking to customize the form embed code to manipulate the values of form inputs? If that's the case, you can refer to this documentation here: How to customize the form embed code.

 

Additionally, as mentioned by Derek here: HubSpot Community - Help with Hidden Fields in Forms - HubSpot Community,

"You can use jQuery to update the value of the hidden fields, like this:
$('input[name="firstname"]').val('Brian').change();".

 

Hope this helps to further clarify things!

Exibir solução no post original

0 Avaliação positiva
4 Respostas 4
WendyGoh
Solução
HubSpot Employee
HubSpot Employee

Integrating custom code into forms

resolver

Hi @Annie-L,

 

I hope all is well with you 😄

 

Are you looking to customize the form embed code to manipulate the values of form inputs? If that's the case, you can refer to this documentation here: How to customize the form embed code.

 

Additionally, as mentioned by Derek here: HubSpot Community - Help with Hidden Fields in Forms - HubSpot Community,

"You can use jQuery to update the value of the hidden fields, like this:
$('input[name="firstname"]').val('Brian').change();".

 

Hope this helps to further clarify things!

0 Avaliação positiva
Annie-L
Participante

Integrating custom code into forms

resolver

Hi Wendy, 

 

Thanks for that. From my understanding, jQuery is the coding language? Where can I add this code?

0 Avaliação positiva
WendyGoh
HubSpot Employee
HubSpot Employee

Integrating custom code into forms

resolver

Hi @Annie-L,

 

That is right. You can add the code in your form embed code which you can copy it after clicking the 'Share' button and for this I'd love to share with you this documentation here: Share a HubSpot form on an external site.

0 Avaliação positiva
Annie-L
Participante

Integrating custom code into forms

resolver

Awesome, thanks for the help Wendy! 🙂

0 Avaliação positiva