# How to check if a text input is number

**URL:** <https://community.thunkable.com/t/how-to-check-if-a-text-input-is-number/2976107>\
**Category:** Questions about Thunkable X\
**Created:** [April 29, 2024, 10:02pm UTC](https://community.thunkable.com/t/how-to-check-if-a-text-input-is-number/2976107 "2024-04-29T22:02:03Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![samir.henry3rz](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/samir.henry3rz/32/176572_2.png) [@samir.henry3rz](https://community.thunkable.com/u/samir.henry3rz)\
**Post date:** [April 29, 2024, 10:02pm UTC](https://community.thunkable.com/t/how-to-check-if-a-text-input-is-number/2976107/1 "2024-04-29T22:02:03Z")

</div>

I recently had a problem validating a number field to prevent the user from sending text instead of a number. So I found this solution that is working for me so far.

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/d/ed640f8838480025ad85c8da884c5fa22fa6551c.png)

As any number is divisible by 1, the result will always be true, but when adding a letter the result will be false.

---

<div class="post-metadata">

**Author:** ![pacecode](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/pacecode/32/209017_2.png) [@pacecode](https://community.thunkable.com/u/pacecode)\
**Post date:** [April 30, 2024, 10:14am UTC](https://community.thunkable.com/t/how-to-check-if-a-text-input-is-number/2976107/2 "2024-04-30T10:14:58Z")

</div>

You can change the Keyboard Type in Input Component Details to Numerical.  
 ![Screenshot 2024-04-30 at 3.44.17 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/6/96698083aafacc2c5be36846cd811517de129272.png)

* * *

Want to hire a Certified Thunkable Expert? [Whoocoder | Thunkable Expert | Hire Now On Fiver!!](https://pro.fiverr.com/certified/thunkable?utm_source=fiverr_certified&utm_medium=homepage&utm_campaign=certified_home&service=thunkable-project&active_expert_id=147498421)

---

<div class="post-metadata">

**Author:** ![samir.henry3rz](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/samir.henry3rz/32/176572_2.png) [@samir.henry3rz](https://community.thunkable.com/u/samir.henry3rz)\
**Post date:** [April 30, 2024, 10:45am UTC](https://community.thunkable.com/t/how-to-check-if-a-text-input-is-number/2976107/3 "2024-04-30T10:45:01Z")

</div>

But on android, there is an option to paste any text into the field. Therefore, there is no point in the field being defined as numeric.

---

<div class="post-metadata">

**Author:** ![pacecode](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/pacecode/32/209017_2.png) [@pacecode](https://community.thunkable.com/u/pacecode)\
**Post date:** [April 30, 2024, 10:52am UTC](https://community.thunkable.com/t/how-to-check-if-a-text-input-is-number/2976107/4 "2024-04-30T10:52:05Z")

</div>

Strings won’t get Pasted, try it.

* * *

Want to hire a Certified Thunkable Expert? [Whoocoder | Thunkable Expert | Hire Now On Fiver!!](https://pro.fiverr.com/certified/thunkable?utm_source=fiverr_certified&utm_medium=homepage&utm_campaign=certified_home&service=thunkable-project&active_expert_id=147498421)

---

<div class="post-metadata">

**Author:** ![pacecode](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/pacecode/32/209017_2.png) [@pacecode](https://community.thunkable.com/u/pacecode)\
**Post date:** [April 30, 2024, 10:54am UTC](https://community.thunkable.com/t/how-to-check-if-a-text-input-is-number/2976107/5 "2024-04-30T10:54:35Z")

</div>

Or if you want, here’s a Post to do that:

> [@How to check if text input is a number?](https://community.thunkable.com/t/how-to-check-if-text-input-is-a-number/482221/3):
>
> Hey @bramgrooten As a work-around you can multiply your input by 1 to “sanitise” the user data like this:

* * *

Want to hire a Certified Thunkable Expert? [Whoocoder | Thunkable Expert | Hire Now On Fiver!!](https://pro.fiverr.com/certified/thunkable?utm_source=fiverr_certified&utm_medium=homepage&utm_campaign=certified_home&service=thunkable-project&active_expert_id=147498421)

---

<div class="post-metadata">

**Author:** ![samir.henry3rz](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/samir.henry3rz/32/176572_2.png) [@samir.henry3rz](https://community.thunkable.com/u/samir.henry3rz)\
**Post date:** [April 30, 2024, 11:15am UTC](https://community.thunkable.com/t/how-to-check-if-a-text-input-is-number/2976107/6 "2024-04-30T11:15:45Z")

</div>

I took this test. I copied a string from a notepad and pasted it into the field in the live test and it actually pasted normally. I don’t know if it could be a bug in the thunkable, but in the test, it pasted the string.

---

<div class="post-metadata">

**Author:** ![samir.henry3rz](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/samir.henry3rz/32/176572_2.png) [@samir.henry3rz](https://community.thunkable.com/u/samir.henry3rz)\
**Post date:** [April 30, 2024, 11:17am UTC](https://community.thunkable.com/t/how-to-check-if-a-text-input-is-number/2976107/7 "2024-04-30T11:17:13Z")

</div>

But with just these blocks, number validation is perfect.

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/8/e84022c45e7147e4b9cd28629a1865260c9ff96a.png)

---

<div class="post-metadata">

**Author:** ![pacecode](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/pacecode/32/209017_2.png) [@pacecode](https://community.thunkable.com/u/pacecode)\
**Post date:** [April 30, 2024, 11:35am UTC](https://community.thunkable.com/t/how-to-check-if-a-text-input-is-number/2976107/8 "2024-04-30T11:35:15Z")

</div>

We Can do it this way too

 ![Screenshot 2024-04-30 at 5.04.11 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/d/0def0af75c42f0f0961d9c039f439517d1067a0e.png)

* * *

Want to hire a Certified Thunkable Expert? [Whoocoder | Thunkable Expert | Hire Now On Fiver!!](https://pro.fiverr.com/certified/thunkable?utm_source=fiverr_certified&utm_medium=homepage&utm_campaign=certified_home&service=thunkable-project&active_expert_id=147498421)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [July 29, 2024, 11:35am UTC](https://community.thunkable.com/t/how-to-check-if-a-text-input-is-number/2976107/9 "2024-07-29T11:35:31Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
