# Integrating custom code into forms

**URL:** <https://community.hubspot.com/t/integrating-custom-code-into-forms/16343>\
**Category:** APIs & Integrations\
**Tags:** forms\
**Created:** [September 19, 2019, 11:42pm UTC](https://community.hubspot.com/t/integrating-custom-code-into-forms/16343 "2019-09-19T23:42:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Annie-L](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/annie-l/32/35493_2.png) [@Annie-L](https://community.hubspot.com/u/Annie-L)\
**Post date:** [September 19, 2019, 11:42pm UTC](https://community.hubspot.com/t/integrating-custom-code-into-forms/16343/1 "2019-09-19T23:42:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [September 20, 2019, 2:42am UTC](https://community.hubspot.com/t/integrating-custom-code-into-forms/16343/2 "2019-09-20T02:42:02Z")

</div>

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](https://developers.hubspot.com/docs/methods/forms/advanced_form_options).

Additionally, as mentioned by Derek here: [HubSpot Community - Help with Hidden Fields in Forms - HubSpot Community](https://community.hubspot.com/t5/APIs-Integrations/Help-with-Hidden-Fields-in-Forms/td-p/241959),

"_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!

---

<div class="post-metadata">

**Author:** ![Annie-L](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/annie-l/32/35493_2.png) [@Annie-L](https://community.hubspot.com/u/Annie-L)\
**Post date:** [September 20, 2019, 3:06am UTC](https://community.hubspot.com/t/integrating-custom-code-into-forms/16343/3 "2019-09-20T03:06:52Z")

</div>

Hi Wendy,

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

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [September 20, 2019, 6:16am UTC](https://community.hubspot.com/t/integrating-custom-code-into-forms/16343/4 "2019-09-20T06:16:38Z")

</div>

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](https://knowledge.hubspot.com/articles/kcs_article/forms/how-can-i-share-a-hubspot-form-if-im-using-an-external-site).

---

<div class="post-metadata">

**Author:** ![Annie-L](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/annie-l/32/35493_2.png) [@Annie-L](https://community.hubspot.com/u/Annie-L)\
**Post date:** [September 20, 2019, 7:05am UTC](https://community.hubspot.com/t/integrating-custom-code-into-forms/16343/5 "2019-09-20T07:05:20Z")

</div>

Awesome, thanks for the help Wendy! 🙂
