Tips, Tricks & Best Practices

Mike_Eastwood
Recognized Expert | Gold Partner
Recognized Expert | Gold Partner

How to collect data from a hidden field in a Non-HubSpot Forms

We had an interesting challenge this week - using hidden fields in a non-HubSpot Form. Usually we embed HubSpot forms in websites to make it easy to control. But in this case the website was all custom bespoke code with forms on hundreds of pages.

 

We wanted the hidden field to populate a Custom Property in the Contact Record to trigger a Workflow. The data in the field is dynamically generated so it wasn't practical to create custom forms for each page.

 

If you add a hidden field to a non-HubSpot Form then HubSpot will ignore it when parsing the form data.

 

So, what we did was add a normal Text Input Field - with a dynamically populated default value - then hid the field with CSS (display: none).

 

HubSpot then parses the data in the field and updates the contact property. The visitor doesn't see another potentially confusing field and we only had to make one code change.

 

Hope this helps you.

Mike

6 Replies 6
joe12south
Participant

How to collect data from a hidden field in a Non-HubSpot Forms

I had the exact same need, ran into the same issue, and tried the same "trick", but it didn't work. If I style the text input with display:none, HubSpot ignores it. 

0 Upvotes
joe12south
Participant

How to collect data from a hidden field in a Non-HubSpot Forms

Note. Using CSS to hide the input fails, but wrapping it in a div and setting the div's "display:none" works. The user does not see the field, but HubSpot uses it.

YGC
Participant

How to collect data from a hidden field in a Non-HubSpot Forms

Simple and clever solution. Thanks so much!

Jaycee_Lewis
Community Manager
Community Manager

How to collect data from a hidden field in a Non-HubSpot Forms

Brilliant 💡 Thank you, @Mike_Eastwood 🙌

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

EllaSheen
Participant

How to collect data from a hidden field in a Non-HubSpot Forms

Very helpful. Thanks for sharing.

kvlschaefer
Community Manager
Community Manager

How to collect data from a hidden field in a Non-HubSpot Forms

Thanks for sharing this with us, @Mike_Eastwood!


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !