APIs & Integrations

ianpetzer
Teilnehmer/-in

How to stop collected-forms from collecting a form

HI there,

 

We've been using Collected forms for a few years and I've noticed that as of August 2019 it appears that the collected forms script is now collecting form submissions for dynamically created forms that weren't present when the collected forms script loaded. The documentation is no longer correct with regard to this: https://knowledge.hubspot.com/forms/use-non-hubspot-forms

 

Its great to see that Hubspot is improving the collected-forms javascript but we have a single page application and we don't want all of the forms to be collected. Some of them are sensitive for GDPR purposes and we don't want to submit them to Hubspot, plus, they are messing up the details of our contacts in Hubspot.

 

I have tried to add an event listent to to the form to prevent default on the event and I've tried changing the type of the button from "submit" to a a regular button based on what the documentaiton above suggests would cause a form not to submit but the form is still submitting.

 

How can I mark a form as not requiring collection by Hubspot collected-forms?

 

Thanks!

3 Antworten
WendyGoh
HubSpot Employee
HubSpot Employee

How to stop collected-forms from collecting a form

Hi @ianpetzer,

 

While it is currently not possible to stop collection of certain form when the non HubSpot settings is enabled, I was able to locate this discussion forum: https://community.hubspot.com/t5/Lead-Capture-Tools/Ignore-a-specific-non-Hubspot-form-from-being-co... where one of the contributor shared this solution:

 

<label for="amex" style="display:none">AMEX</label>
<input type="hidden" name="amex" required="" value="" id="amex">'

looks like this would prevent a form from being collected. Hopefully this helps!

0 Upvotes
ianpetzer
Teilnehmer/-in

How to stop collected-forms from collecting a form

Hi @WendyGoh ,

 

Thanks for that link. Is it possible to comment on the fact that dynamically created forms are now being collected by Hubspot collected-forms.js . This does not conform to the documenation here https://knowledge.hubspot.com/forms/use-non-hubspot-forms

 

We've been using collected-forms.js for years (even back when it was called lead-in.js) and I can confirm that dynamically created forms started getting collected in our app as of August 2019

 

ps: That workaround didnt work for me but the following seems to block my form from being collected:

 

.hidden {
  display: none;
}

<label for="credit-card" class="hidden">HubspotCollectedFormsWorkaround https://community.hubspot.com/t5/APIs-Integrations/How-to-stop-collected-forms-from-collecting-a-form/m-p/299172#M28102</label>
   
<input name="credit-card" class="hidden" required="" value="HubspotCollectedFormsWorkaround" id="credit-card">

 

 

0 Upvotes
ianpetzer
Teilnehmer/-in

How to stop collected-forms from collecting a form

've gone and looked at the source for collected-forms.js

They check for the following labels:

, s = ["credit card", "card number", "expiration", "expiry", "ccv", "cvc", "cvv", "secure code", "mastercard", "american express", "amex"]

and the following for names:
, c = ["cc-num", "cc-number"]

 

in a function called isSensitive which is used in a function called rejectIfAnyFieldSensitive

 

So I've managed to get the form to not submit with the following markup:

 

    <label for="cc-num" class="hidden">credit card HubspotCollectedFormsWorkaround https://community.hubspot.com/t5/APIs-Integrations/How-to-stop-collected-forms-from-collecting-a-form/m-p/299172#M28102</label>
    <input name="cc-num" class="hidden" required="" value="HubspotCollectedFormsWorkaround" id="cc-num">

Would be great if this could be added to the documentation