# Can I limit a TEXT\_FIELD to only numeric characters?

**URL:** <https://forum.servoy.com/t/can-i-limit-a-text-field-to-only-numeric-characters/4682>\
**Category:** Classic Servoy\
**Created:** [August 31, 2005, 3:19pm UTC](https://forum.servoy.com/t/can-i-limit-a-text-field-to-only-numeric-characters/4682 "2005-08-31T15:19:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ger](https://avatars.discourse-cdn.com/v4/letter/g/cc9497/32.png) [@ger](https://forum.servoy.com/u/ger)\
**Post date:** [August 31, 2005, 3:19pm UTC](https://forum.servoy.com/t/can-i-limit-a-text-field-to-only-numeric-characters/4682/1 "2005-08-31T15:19:22Z")

</div>

I have a TEXT\_FIELD where I want the user to be able to enter only digits. Is it possible to do this using the “format” property? I tried with “#”, but if I place “###” it allows me to enter only 3 digits, if I place “######” it allows me only 6 digits, and so on. I want the user to be able to enter any number of digits.

Thank you,  
Gabriel.

---

<div class="post-metadata">

**Author:** ![bcusick](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@bcusick](https://forum.servoy.com/u/bcusick)\
**Post date:** [August 31, 2005, 4:57pm UTC](https://forum.servoy.com/t/can-i-limit-a-text-field-to-only-numeric-characters/4682/2 "2005-08-31T16:57:26Z")

</div>

Did you try “#####################” ?

---

<div class="post-metadata">

**Author:** ![ger](https://avatars.discourse-cdn.com/v4/letter/g/cc9497/32.png) [@ger](https://forum.servoy.com/u/ger)\
**Post date:** [September 1, 2005, 5:57am UTC](https://forum.servoy.com/t/can-i-limit-a-text-field-to-only-numeric-characters/4682/3 "2005-09-01T05:57:06Z")

</div>

Yes, I did.

If I place N characters of ‘#’, then the field expects me to enter exactly N digits. It goes red if I enter less than N digits.

---

<div class="post-metadata">

**Author:** ![maarten](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@maarten](https://forum.servoy.com/u/maarten)\
**Post date:** [September 1, 2005, 8:16am UTC](https://forum.servoy.com/t/can-i-limit-a-text-field-to-only-numeric-characters/4682/4 "2005-09-01T08:16:56Z")

</div>

If you want the user to only enter digits, why don’t you change the filed type into an integer?

Other solution might be building an onFocusLost script that filters any chars.
