How to iframe a HubSpot form into an external site
I) Get the code for the form:
- Settings > Form Manager
- Find the name of the form, then "Edit" on the right
- "Get Form HTML" top right
- Add the target attribute to the form tag on the first line:
<form target="_blank"
- Select all and copy the code
II) Create an HTML page to host the form code:
- Settings > File Manager
- Click on the folder that you want to add a page to (e.g. "forms" or create a new folder for it)
- Choose "New File"
- Name it something related to the form, followed by .html (e.g. "myform.html")
- The URL will now be your file manager path name, plus the folder, plus the file name
(e.g. http://subdomain.domain_name.tld/Portals/#####/forms/myform.html")
- Paste the code from Section I into this new file
- Save & Close
III) Use iframe to insert the form into your external site:
- The code should look like:
<iframe src="http://subdomain.domain-name.tld/Portals/#####/forms/myform.html" frameborder="0" width="100%" height="800px"><p>Your browser does not support iframes</p></iframe>
- The src="" should be the path of the HTML file from Section II Step 5
- The height="800px" should be adjusted to fit the form (by using developer tools or trial and error until it fits)
- Paste the resulting iframe code into your external page, and then save and upload it to your server.