HubSpot forms
Marketing Hub
- Starter or Enterprise
Sales Hub
- Starter, Professional, or Enterprise
Service Hub
- Starter, Professional, or Enterprise
CMS Hub
- Professional or Enterprise
Use HubSpot forms to capture information from users which you can then access throughout HubSpot. Captured form data can be used in assets such as smart content, lists, workflows, content personalization, and more.
Forms are a core part of the HubSpot suite, and can be created in a HubSpot account of any subscription level. You can share links to forms directly with users, submit form data via the API, and embed them on your website pages using the CMS.
In this guide, learn more about how to incorporate forms into your website with the CMS. To learn how to create forms on HubSpot, check out HubSpot's Knowledge Base.
After creating a HubSpot form, you can add it to your templates and pages. There are multiple ways that a form can be added to a template and which one you choose depends on your use case. Below, learn how to add forms to a template using the following methods:
Using the form module
Using the default form module, content creators can select forms and configure form options within the page editor. To enable this, you can add the form module to a drag and drop area in your template.
If you're not using a drag and drop area in your coded template, you can generate the forms module with the following syntax. Using this tag, you can also specify form details, such as setting a specific form or its redirect options. You can learn more about using the form HubL tag in the section below.
There are some cases where you may be creating a custom module that incorporates a form alongside some other content, such as images or text blocks. To accomplish this, you can either use the form field or clone the existing form module and build your new module from there as a starting point.
The form field is a simpler version of the form module that gives you basic form functionality, including:
Options | Description |
---|---|
Form selection dropdown | A dropdown menu that enables content creators to select an existing form. |
Form submission redirect | An option for choosing whether the submitter will be redirected or shown an inline thank you message on form submission. |
Redirect link | If you choose to redirect a submitter, you can enter the URL of the page the user will be redirected to. |
Thank you message | If you choose to show an inline thank you message, you can enter your message here. |
You can add the form field to a module in the design manager by selecting it through the Add field > Selectors > Form option.
From there, you can then copy the snippet for the form field to add to your custom module by choosing Actions > Copy snippet when hovering over the field in the editor.
If you choose to clone the default form module you will get everything from the form field above, including:
Options | Description |
---|---|
Title | Add a that will be displayed above the form when its rendered. |
Email notification override | A toggle that will allow you to override the default email address for the form notifications. If toggled on, you will see a text field to add the new email addresses. |
Add to workflow | A toggle that will let you enroll submissions into the desired workflow. If toggled on, you will be presented with a dropdown to choose a workflow. |
Follow up email | A toggle that will let you send a follow-up email once the form has been submitted. If toggled on, you will be presented with a dropdown to choose a follow-up email. If you don't have an existing one, you will be given the option to create a new one. |
Salesforce campaign | Specifies the Salesforce campaign to enroll contacts who submit the form into. Only available if the Salesforce integration is installed. |
GoToWebinar link | Specifies the GoToWebinar webinar to enroll contacts who submit the form into. Only available if the GoToWebinar integration is installed. |
You can further build your form with additional options that can be used alongside the default form module. Below is an example of a cloned default module wrapped in a <section>
tag and with an additional color field to add a background color to the section.
The module form field generates a HubL form tag when you copy snippet, as mentioned above. The HubL tag has many parameters you can provide. It's easiest to use copy snippet when working from the design manager. When working locally, refer to the HubL tags documentation, which details all of the parameters available.
You can use a JavaScript embed code to add a form to page where a module or HubL tag isn't ideal, such as on external pages. Using this method, you can also extend the functionality of the form through advanced options. Below is a sample of the form embed code with extended functionality.
While HubSpot offers form styling from a global setting and form specific setting level, you can also style a form depending on how it's added to your CMS pages.
Please note: all forms generated on the HubSpot CMS (excluding using the form embed code) will ignore any styling that is configured via the global form settings or the form's individual settings.
HubSpot forms added to HubSpot pages can be styled using your website's CSS. HubSpot includes a number of different classes and attributes on forms that are generated where you can apply styling. As a starting point, refer to the HubSpot Boilerplate's form CSS, which represents the best practices for how to style forms.
Forms inside custom modules can be styled by CSS in the module's CSS pane within the design manager. By keeping CSS scoped to the module, you can ensure that whenever the module is added to a page, the styling comes with it. It's recommended to add a wrapper to the form, then using that wrapper as the top-level selector for the CSS. This will prevent your custom module's form styling from being overwritten by additional styles in your websites main stylesheet. Below is a screenshot of the custom module from above with form styling added to the CSS Pane.
Styling forms added via the form embed code
When using the form embed code, you can style the form using the global form styling settings or using your website's CSS.
Using the global form styling settings enables you to configure default settings for every form in the account. You can also override these styles on an individual form within the form editor.
When choosing to style the form using your website's CSS, you should first turn on the option Set as raw HTML form within the form editor. This allows the form to be rendered on the page as HTML instead of an iframe, which makes styling easier. Learn more about styling embedded forms on the Knowledge Base.
Thank you for your feedback, it means a lot to us.