APIs & Integrations

Annie-L
参加者

Integrating custom code into forms

解決

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 いいね!
1件の承認済みベストアンサー
WendyGoh
解決策
HubSpot Employee
HubSpot Employee

Integrating custom code into forms

解決

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 いいね!
4件の返信
WendyGoh
解決策
HubSpot Employee
HubSpot Employee

Integrating custom code into forms

解決

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 いいね!
Annie-L
参加者

Integrating custom code into forms

解決

Hi Wendy, 

 

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

0 いいね!
WendyGoh
HubSpot Employee
HubSpot Employee

Integrating custom code into forms

解決

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 いいね!
Annie-L
参加者

Integrating custom code into forms

解決

Awesome, thanks for the help Wendy! 🙂

0 いいね!