# Restrict Data Entered on a Form

**URL:** <https://community.hubspot.com/t/restrict-data-entered-on-a-form/92623>\
**Category:** Lead Capture Tools\
**Tags:** forms\
**Created:** [October 25, 2023, 11:48pm UTC](https://community.hubspot.com/t/restrict-data-entered-on-a-form/92623 "2023-10-25T23:48:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LaurelShoger](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@LaurelShoger](https://community.hubspot.com/u/LaurelShoger)\
**Post date:** [October 25, 2023, 11:48pm UTC](https://community.hubspot.com/t/restrict-data-entered-on-a-form/92623/1 "2023-10-25T23:48:42Z")

</div>

What we are doing: Car dealers are filling out a form built on HubSpot. One of the fields is always a 7-digit number.

Our issue: The 7-digit number starts with 00, 01, and 010. Sometimes the number can have multiple 0s such as 0000567. The dealers in this case are just entering 567, when we need 0000567 for the automation process to work properly.

What we tried: We have created a Number Ticket Property and a single-line text Ticket Property. But we found out from HubSpot support that their Forms do not follow rules established on Ticket Properties.

Solution? Do you know of a way that we can set up a workflow, a 3rd party app, or really anything that will allow us to require the response to this property on the form to be restricted to having 7 digits?

---

<div class="post-metadata">

**Author:** ![Mike\_Eastwood](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mike_eastwood/32/70075_2.png) [@Mike\_Eastwood](https://community.hubspot.com/u/Mike_Eastwood)\
**Post date:** [October 26, 2023, 2:05am UTC](https://community.hubspot.com/t/restrict-data-entered-on-a-form/92623/2 "2023-10-26T02:05:14Z")

</div>

Hi @LaurelShoger

Depending on which HubSpot packages you have access to this could be done within HubSpot. But, you would need Ops Hub to manage the data.

An alternative would be a Custom Module ([that customizes the Form’s embed code](https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options)) adding some JavaScript to the form to format the data when they fill out the form. This solution would require a minimum of Marketing Hub Pro or CMS Hub Pro subscription.

Happy to show you some examples of Forms we’ve done for our clients.

Cheers

Mike

Here to learn more about HubSpot and share my HubSpot Knowledge. I’m the founder of [Webalite](https://www.webalite.com?utm_campaign=community-forum&utm_source=community&utm_content=signature) a Gold HubSpot Partner Agency based in Wellington, New Zealand and the founder of **Portal-iQ** the world’s first automated [HubSpot Portal Audit](https://portal-iq.com?utm_campaign=community-forum&utm_source=community-forum&utm_content=signature) that helps you work smarter with HubSpot.

---

<div class="post-metadata">

**Author:** ![LaurelShoger](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@LaurelShoger](https://community.hubspot.com/u/LaurelShoger)\
**Post date:** [October 26, 2023, 4:07pm UTC](https://community.hubspot.com/t/restrict-data-entered-on-a-form/92623/3 "2023-10-26T16:07:36Z")

</div>

Hi [@Mike\_Eastwood](https://community.hubspot.com/t5/user/viewprofilepage/user-id/9259)!

I think we have access to those subscriptions! I would greatly appreciate you sending any examples and details you have. I am not super verse with HubSpot, yet, so any smaller details would be helpful as well.

Thank you so much!

Laurel

---

<div class="post-metadata">

**Author:** ![Mike\_Eastwood](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mike_eastwood/32/70075_2.png) [@Mike\_Eastwood](https://community.hubspot.com/u/Mike_Eastwood)\
**Post date:** [October 27, 2023, 9:37pm UTC](https://community.hubspot.com/t/restrict-data-entered-on-a-form/92623/4 "2023-10-27T21:37:55Z")

</div>

Hi Laurel

My assumption (no offence to car dealers) is that easy is good. So, I would zerofill the field after the form is submitted using a [Custom Code Workflow Action](https://developers.hubspot.com/docs/api/workflows/custom-code-actions).

[JavaScript’s padStart()](https://www.w3schools.com/jsref/jsref_string_padstart.asp) can zerofil the data.

Using your example from above:

```lia-code-sample
let number_entered = 567;
let number_string = number_entered.toString();
let number_padded = number_string.padStart(7,"0");

```

This would convert “567” to “0000567” and “100567” to “0100567”.

The geeky bit is setting up the Custom Workflow Action. Rather than replicate all the steps you can follow the process here: [Workflows | Custom Code Actions - HubSpot docs](https://developers.hubspot.com/docs/api/workflows/custom-code-actions#create-a-custom-code-action)

For people that don’t have access to Custom Code Workflow Actions (Ops Hub Pro is required) the same code could be used to zerofill the form when people enter it. This would require customization of the [Form Embed Code](https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options).

If you are a normal human - and not a geek like me - then [please get in touch](https://www.webalite.com/contact-us).

Have fun

Mike
