HubSpot form iframe sizing issues in SharePoint web part

I’m running into a frustrating issue while trying to display a HubSpot form inside a SharePoint web part using an iframe. The height settings don’t seem to work properly no matter what I try.

When I configure the iframe height to 100%, the form gets cut off and users can’t see all the fields or submit buttons. But if I bump it up to 200%, the entire form becomes visible, though this creates other problems.

The main issue with the 200% setting is that when users resize their browser window, the iframe doesn’t adjust accordingly. Since there’s no scroll bar available, important elements like buttons disappear from view. This makes the form unusable for many visitors.

I also discovered that adding custom JavaScript to embedded web parts isn’t allowed, which limits my options for creating a dynamic solution. Has anyone else encountered similar iframe height problems when embedding external forms in SharePoint? What workarounds or solutions have worked for you?

Hit this exact nightmare about six months ago with a client’s SharePoint setup. The percentage height breaks because SharePoint calculates container dimensions before the iframe content actually loads - creates a total mismatch.

Here’s what fixed it: I built a simple HTML wrapper page on the same domain that holds the HubSpot form with proper responsive CSS. Then embedded that wrapper instead of the direct HubSpot form URL. You get full control over container dimensions without breaking form functionality.

The wrapper uses viewport height calculations and media queries for browser resizing. Since SharePoint blocks custom JavaScript in web parts, putting the responsive logic in the wrapper completely bypasses that restriction. Form stays accessible on all devices and submit buttons don’t disappear when users resize windows.

I encountered a similar challenge with third-party forms in SharePoint. The issue with percentage-based height values is common—SharePoint’s iframe setup often doesn’t accommodate responsive sizing effectively. To resolve this, I recommend abandoning the percentage height approach for a fixed height. Ensure you open your HubSpot form in a new tab and inspect the element to find the accurate height, then add an extra 50px for good measure. Additionally, discuss with your SharePoint admin about enabling the Script Editor web part for enhanced control over embed settings; it’s often disabled by default but can usually be activated upon request. Finally, explore if HubSpot offers any direct integrations with SharePoint to streamline the process without relying on iframe.

The Problem:

You’re experiencing frustrating height issues when embedding a HubSpot form in a SharePoint web part using an iframe. Using percentage-based heights (e.g., height: 100%) results in truncated forms, while fixed percentages (e.g., height: 200%) create responsiveness problems as the iframe doesn’t resize with the browser window, causing elements to disappear. Furthermore, SharePoint’s restrictions on custom JavaScript within embedded web parts limit your options for dynamic resizing solutions.

:thinking: Understanding the “Why” (The Root Cause):

The core problem lies in the incompatibility between SharePoint’s web part rendering and the dynamic nature of iframes containing responsive content like HubSpot forms. SharePoint calculates the iframe dimensions before the iframe content fully loads. This timing conflict leads to incorrect height calculations when using percentage-based heights. Fixed-height solutions, while initially appearing to work, break down when the browser window is resized because the iframe’s height remains static, obscuring content. The inability to inject custom JavaScript further prevents you from implementing a dynamic resizing solution directly within the SharePoint web part.

:gear: Step-by-Step Guide:

  1. Ditch the iframe completely: This is the most robust and future-proof solution. Instead of embedding the HubSpot form using an iframe, create a custom form (or use a minimal form solution that is purely HTML & CSS) and use a webhook to capture form submissions. Then, use the HubSpot API to push the captured data into your HubSpot CRM.

  2. Set up a webhook: Configure a webhook within your form technology to trigger an event when a form is submitted. This event should send the form data as a payload to your backend system.

  3. Create a backend endpoint: Develop a backend endpoint (e.g., using Node.js, Python, or a serverless function) to receive the webhook payload. This endpoint will handle processing the incoming data and forwarding it to the HubSpot API.

  4. Integrate with the HubSpot API: Use the HubSpot API to send the processed form data to your HubSpot CRM. This step requires authentication with the HubSpot API and understanding how to structure the data for proper import.

:mag: Common Pitfalls & What to Check Next:

  • Webhook Configuration: Double-check that your webhook URL is correctly configured in your form technology and that the payload format matches your backend endpoint’s expectations.
  • Authentication: Ensure you have properly authenticated your backend system with the HubSpot API to allow data transfer.
  • Data Mapping: Carefully map the fields from your custom form to the corresponding fields in your HubSpot CRM. Errors here can lead to incomplete or inaccurate data in HubSpot.
  • Error Handling: Implement robust error handling in both your backend and webhook to manage potential failures, network errors, and unexpected data formats. Consider logging errors to track down issues.
  • SharePoint Permissions: Ensure your SharePoint users have the necessary permissions to access and interact with your custom form solution within SharePoint.

:speech_balloon: Still running into issues? Share your (sanitized) config files, the exact command you ran, and any other relevant details. The community is here to help!

ugh this exact thing happened to me last month! try setting a fixed pixel height instead of percentages - like 600px or whatever works for your form. also check if hubspot has a responsive embed option, some forms have better mobile handling built in.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.