Optimizing HubSpot Form Embeds: Solutions for Multiple Forms on a Single Page

Illustration of multiple HubSpot forms successfully embedded and displayed distinctly on a single web page, with underlying code snippets suggesting proper technical setup.
Illustration of multiple HubSpot forms successfully embedded and displayed distinctly on a single web page, with underlying code snippets suggesting proper technical setup.

The challenge of embedding multiple HubSpot forms on a single web page is a common technical hurdle for developers and marketers alike. While HubSpot is a powerful platform for lead capture and customer engagement, integrating multiple forms, especially on external builders like Webflow, can sometimes lead to unexpected rendering issues where only one form appears. This article delves into the root causes of this problem and provides actionable solutions to ensure all your HubSpot forms display correctly.

Understanding the Multiple Form Rendering Challenge

When attempting to embed two or more HubSpot forms on the same page, a frequent observation is that only the first form in the Document Object Model (DOM) renders successfully, leaving subsequent form containers blank. This behavior often stems from how HubSpot's embed script initializes. The script is typically designed to find and process the first instance of a form embed it encounters. If multiple forms share the same default container ID or if the script isn't explicitly instructed to handle each form separately, it can lead to conflicts where subsequent forms are overlooked.

The core of the issue isn't a limitation by HubSpot on the number of forms per page, but rather a conflict in the initialization process. Each form embed needs its own distinct space and instructions to ensure proper loading. Without this, forms can "fight over the same container or script initialization," resulting in only the first one successfully completing its load cycle.

Strategies for Embedding Multiple HubSpot Forms

Successfully embedding multiple HubSpot forms on a single page requires careful attention to the embed code and the target containers. The primary solutions revolve around providing unique identifiers for each form and ensuring the HubSpot embed script is instructed to render each one individually.

1. Utilize Unique Container IDs for Each Form

The most critical step is to assign a unique HTML container (e.g., a div) for each HubSpot form you wish to embed. Each container must have a distinct id attribute.

For example, if you have two forms, your HTML structure might look like this:


2. Employ Separate Embed Calls with the target Option

After defining unique containers, you need to modify the HubSpot embed code for each form to explicitly target its respective container. HubSpot's forms JavaScript API allows you to specify a target element where the form should be rendered.

For each form, you will have a separate embed script block. Each block should include the portalId, formId, and crucially, a unique target property pointing to its dedicated container ID.

Here’s an example of how to embed two different HubSpot forms using the target option:







Note: Ensure you replace YOUR_PORTAL_ID, YOUR_FIRST_FORM_ID, and YOUR_SECOND_FORM_ID with your actual HubSpot account and form identifiers.

3. Using formInstanceId for Legacy Forms (If Applicable)

For those working with older, "legacy" HubSpot forms, the formInstanceId option might be relevant. This option provides a unique identifier for each form instance, preventing conflicts. While the target option is generally preferred and more versatile for modern forms, formInstanceId served a similar purpose for legacy implementations. If you are using newer HubSpot forms, focusing on the target option is the recommended approach. You can refer to HubSpot's developer documentation for specifics on legacy form embedding if this applies to your scenario.

Best Practices and User Experience Considerations

While technically feasible, it's also worth considering the user experience (UX) when planning multiple forms on a single page. If the forms are identical or serve very similar purposes (e.g., two "Contact Us" forms), it might be more effective from a UX perspective to have a single, prominent form. A common alternative is to use a call-to-action button in the hero section that scrolls the user down to a single, well-placed form at the bottom of the page. This approach can reduce visual clutter and improve conversion rates by streamlining the user journey.

However, if your use case genuinely requires distinct forms (e.g., a newsletter signup form and a demo request form), then implementing the unique container and target option strategy outlined above is the correct technical path.

Always test your page thoroughly after implementing these changes to ensure all forms render correctly across different browsers and devices. Keep an eye on your browser's developer console for any JavaScript errors that might indicate an issue with the embed scripts.

By following these guidelines, you can effectively embed multiple HubSpot forms on a single page, ensuring a seamless experience for your visitors and robust data collection for your marketing and sales efforts. This precise control over form rendering is crucial for maintaining a clean CRM and preventing the influx of incomplete or incorrectly submitted data, directly contributing to more efficient shared inbox management and making it easier for an AI spam filter to identify and block irrelevant submissions.

Share:

Ready to stop spam in your HubSpot inbox?

Install the app in minutes. No credit card required for the free Starter plan.

Install on HubSpot

No HubSpot Account? Get It Free!