Has anyone solved the HubSpot issue of the data being submitted without required fields filled out?

Is there a fix for this? Please note: each time the submit button is clicked on your non-HubSpot form it will trigger a form submission in HubSpot. This includes instances where a user has not filled out all required fields and clicks the submit button, HubSpot will record this action as a form submission.

Check out the filter gform_hubspot_output_tracking_script which can be used to prevent loading of the HubSpot tracking script which handles that behavior.


So, is this line of code ready “as is” to prevent this? The page is sparse on direct information for me. I appreciate the response.

Just making sure I am understanding this right- add this to the functions.php of theme and it is good to go—?
add_filter( 'gform_hubspot_output_tracking_script' , '__return_false' );

Yes, that can be added as is to your theme or child theme functions.php. That line will prevent the HubSpot scripts from being included. They are responsible for sending incomplete or invalid submissions from your website to HubSpot. When using this line, data from your forms will be sent to HubSpot only when the HubSpot feed is processed, which happens after the form is validated and an entry is created.

Let us know if you have any other questions.

1 Like

I will give it a try and follow up- thanks!

Is it possible that the filter should be placed somewhere else in the theme files? It doesn’t appear to do anything to stop the form information from entering Hubspot without all the required information being filled out. The form doesn’t go through on the website and requires the user to fill out missing information.

So frustrating…does it matter the line is pasted into the functions.php file, it is required to be at the top of the page?

Thanks for your time assisting. I appreciate it.

I have been trouble shooting the problem and the form still sends without required information

Any other options you have heard of working? Is there anything coming in the way of an update for the plugin to make sure the required fields work with HubSpot?

I’m bumping this. Do you have any other suggestions?

@tdm-k you wouldn’t happen to have the official HubSpot WordPress plugin installed on your site alongside the Gravity Forms Hubspot add-on?

Sorry answered to fast- i have installed and active…
Gravity Forms
Gravity Forms Google Analytics Add on
Gravity Forms Hubspot Add on

@tdm-k can you post a link to the page this form is embedded on?

It looks like this thread died recently. I’m having this same problem - spammers are being blocked by both Gravity Forms and another service we use called CleanTalk, but they are sailing right through to Hubspot and our sales team is getting the spam leads there. I have added several variations of the code linked above and it still continues to happen. What are we missing?

The filter mentioned above will prevent the Gravity Forms add-on from including the tracking script on the site. However, it is common for other HubSpot-related plugins to also print the script to the page. If that is the case, it will pick up data entered to any form on the site. You’ll want to check whether any other plugin may be also adding the script.

We are only using the Gravity Forms HubSpot Add-On, no other Hubspot plugins

I can confirm this code is definitely not working as we had two complete gibberish entries come through on required, validated Gravity fields last night. So it’s still pushing through anything that is in the fields when people click Submit.

This screenshot shows the code that is not doing anything - look at line 1448

Can you provide a link to the page where the form is embedded?

Please open a support ticket if you don’t want to post it publicly: https://www.gravityforms.com/open-support-ticket/technical/

Richard, it is here: Contact Us | Start Internet Marketing Services | The Ad Firm

The tracking script is NOT present in the page source code, so any new submissions have another source.