# Form duplication when using hbspt.forms.create

**URL:** <https://community.hubspot.com/t/form-duplication-when-using-hbspt-forms-create/46329>\
**Category:** APIs & Integrations\
**Tags:** developer-tools, forms, events, professional\
**Created:** [November 2, 2021, 1:55pm UTC](https://community.hubspot.com/t/form-duplication-when-using-hbspt-forms-create/46329 "2021-11-02T13:55:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![EyalBin](https://avatars.discourse-cdn.com/v4/letter/e/9de053/32.png) [@EyalBin](https://community.hubspot.com/u/EyalBin)\
**Post date:** [November 2, 2021, 1:55pm UTC](https://community.hubspot.com/t/form-duplication-when-using-hbspt-forms-create/46329/1 "2021-11-02T13:55:36Z")

</div>

Hi all,

I am using a form in a drag & drop template and also some javascript code that is using the hbspt.forms.create function.

Javascript code:

```lia-code-sample
hbspt.forms.create({
 portalId: 'XXXXXX',
 formId: 'a7b18ca3-c163-4df4-9793-XXXXXX',
 onFormReady: function($form, ctx) {
 /* Some code running here */
}
});

```

This is the link to the page:

[https://info.shamir.com/-temporary-slug-26c01c5b-7cfd-4853-b40e-10bc76ab9c9e?hs\_preview=IdgOTyTu-58617120840](https://info.shamir.com/-temporary-slug-26c01c5b-7cfd-4853-b40e-10bc76ab9c9e?hs_preview=IdgOTyTu-58617120840)

The problem is that when the page is uploaded I see another form at the bottom of the page in addition to the form that is part of the template. Ho w can I disable this duplication?

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [November 3, 2021, 3:19pm UTC](https://community.hubspot.com/t/form-duplication-when-using-hbspt-forms-create/46329/2 "2021-11-03T15:19:29Z")

</div>

@EyalBin

That link you provided doesn’t appear to work 😥

If you are using a form module and using that form embed code, you would get two forms.

Can you just remove the form module you added to the template?

---

<div class="post-metadata">

**Author:** ![EyalBin](https://avatars.discourse-cdn.com/v4/letter/e/9de053/32.png) [@EyalBin](https://community.hubspot.com/u/EyalBin)\
**Post date:** [November 3, 2021, 3:33pm UTC](https://community.hubspot.com/t/form-duplication-when-using-hbspt-forms-create/46329/3 "2021-11-03T15:33:18Z")

</div>

Thanks for your reply,

here is a link to page:

[https://info.shamir.com/-temporary-slug-26c01c5b-7cfd-4853-b40e-10bc76ab9c9e?hs\_preview=IdgOTyTu-58617120840](https://info.shamir.com/-temporary-slug-26c01c5b-7cfd-4853-b40e-10bc76ab9c9e?hs_preview=IdgOTyTu-58617120840)

regarding your comment, I need to have the form editable from the module, is there a way to add some javascript code to the form with using sonthing other than bspt.forms.create?

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [November 4, 2021, 1:56pm UTC](https://community.hubspot.com/t/form-duplication-when-using-hbspt-forms-create/46329/4 "2021-11-04T13:56:06Z")

</div>

@EyalBin ,

I think the problem revolves around using both the form module as well as an embed code in your js.

@dbeau79 , do you have some advice here? 😀

---

<div class="post-metadata">

**Author:** ![dbeau79](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dbeau79/32/82797_2.png) [@dbeau79](https://community.hubspot.com/u/dbeau79)\
**Post date:** [November 4, 2021, 3:42pm UTC](https://community.hubspot.com/t/form-duplication-when-using-hbspt-forms-create/46329/5 "2021-11-04T15:42:02Z")

</div>

@EyalBin , you can use [global form events](https://developers.hubspot.com/docs/api-reference/latest/marketing/forms/global-form-events) to run custom JavaScript without embedding the form a second time.

For legacy forms, use the `hsFormCallback` event with `onFormReady`.

For forms created with HubSpot’s updated forms editor, use `hs-form-event:on-ready` instead.

In your case you would use this:

```lia-code-sample
window.addEventListener('message', event => {
 if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormReady') {
 // add the code from the onFormReady callback from your embed code and remove the embed code
 }
});

```

_Moderator Note: this post was reviewed for relevancy and optimized for clarity on October 21st, 2026. Thank you for your contributions to the HubSpot Community!_

---

<div class="post-metadata">

**Author:** ![EyalBin](https://avatars.discourse-cdn.com/v4/letter/e/9de053/32.png) [@EyalBin](https://community.hubspot.com/u/EyalBin)\
**Post date:** [November 6, 2021, 1:10pm UTC](https://community.hubspot.com/t/form-duplication-when-using-hbspt-forms-create/46329/6 "2021-11-06T13:10:44Z")

</div>

Thank you very much @dbeau79 .

Indeed I found the solution in the global form event functions. many, many thanks 🙂

---

<div class="post-metadata">

**Author:** ![Nikitha](https://avatars.discourse-cdn.com/v4/letter/n/df788c/32.png) [@Nikitha](https://community.hubspot.com/u/Nikitha)\
**Post date:** [July 16, 2026, 1:09pm UTC](https://community.hubspot.com/t/form-duplication-when-using-hbspt-forms-create/46329/7 "2026-07-16T13:09:05Z")

</div>

I’m currently finding out how HubSpot forms work, and this discussion helped me understand when to use global form events instead of embedding another form. Thanks for sharing the solution.

---

<div class="post-metadata">

**Author:** ![stassey](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stassey/32/36_2.png) [@stassey](https://community.hubspot.com/u/stassey)\
**Post date:** [July 16, 2026, 1:42pm UTC](https://community.hubspot.com/t/form-duplication-when-using-hbspt-forms-create/46329/8 "2026-07-16T13:42:32Z")

</div>

Hey @Nikitha,

I’m so glad you found this thread helpful!

If you hit any other snags or want to bounce ideas around as you build things out, feel free to start a new thread. The community is here to help!

Sam, Community Manager

---

<div class="post-metadata">

**Author:** ![Kavya\_H\_N](https://avatars.discourse-cdn.com/v4/letter/k/90db22/32.png) [@Kavya\_H\_N](https://community.hubspot.com/u/Kavya_H_N)\
**Post date:** [July 23, 2026, 4:44am UTC](https://community.hubspot.com/t/form-duplication-when-using-hbspt-forms-create/46329/9 "2026-07-23T04:44:05Z")

</div>

I learned something new from this thread. Using global form events seems like a much cleaner approach than creating another form instance.

---

<div class="post-metadata">

**Author:** ![Berangere](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/berangere/32/220784_2.png) [@Berangere](https://community.hubspot.com/u/Berangere)\
**Post date:** [July 23, 2026, 9:23am UTC](https://community.hubspot.com/t/form-duplication-when-using-hbspt-forms-create/46329/10 "2026-07-23T09:23:51Z")

</div>

Hi @Kavya_H_N, that’s great to hear!

[Global form events](https://developers.hubspot.com/docs/api-reference/latest/marketing/forms/global-form-events) can definitely streamline things and help keep your setup more efficient.

Thanks for sharing your feedback, and happy learning as you explore more HubSpot features!

And please don’t hesitate to create a new topic if you have any questions, we are here for you!

Have a wonderful day!  
Bérangère
