# NumericEntryField allows decimals even if the format is set to Integer

**URL:** <https://forum.inductiveautomation.com/t/numericentryfield-allows-decimals-even-if-the-format-is-set-to-integer/61999>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [July 18, 2022, 12:34pm UTC](https://forum.inductiveautomation.com/t/numericentryfield-allows-decimals-even-if-the-format-is-set-to-integer/61999 "2022-07-18T12:34:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![CMuecke](https://avatars.discourse-cdn.com/v4/letter/c/df705f/32.png) [@CMuecke](https://forum.inductiveautomation.com/u/CMuecke)\
**Post date:** [July 18, 2022, 12:34pm UTC](https://forum.inductiveautomation.com/t/numericentryfield-allows-decimals-even-if-the-format-is-set-to-integer/61999/1 "2022-07-18T12:34:44Z")

</div>

Not sure if this is a bug or a caveat with the NumericEntryField, but I have noticed that even if you set the format as Integer, it will still send the decimal value instead of rounding it up.

Notice the Checkout Quantity is showing 5, but the total price calculation shows it is still being passed as 4.5.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/4/a46b082f9fe1281432ffa7c0c2d45404856622de.png)

When you highlight it, it then reveals that it is 4.5.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/a/aa894ba9a2a5e235829d9f6cf8a35b80a9d98783.png)

---

<div class="post-metadata">

**Author:** ![craigb](https://avatars.discourse-cdn.com/v4/letter/c/9f8e36/32.png) [@craigb](https://forum.inductiveautomation.com/u/craigb)\
**Post date:** [July 18, 2022, 1:08pm UTC](https://forum.inductiveautomation.com/t/numericentryfield-allows-decimals-even-if-the-format-is-set-to-integer/61999/2 "2022-07-18T13:08:03Z")

</div>

if you bind the value to a memory tag set to INT it works.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [July 18, 2022, 2:47pm UTC](https://forum.inductiveautomation.com/t/numericentryfield-allows-decimals-even-if-the-format-is-set-to-integer/61999/3 "2022-07-18T14:47:16Z")

</div>

No bug here.

Setting NumericEntryField.props.format to integer does nothing more than format the displayed value. This setting does not modify the “true” value the component is receiving. If you need to force your value to be an integer, then you need to supply the Numeric Entry Field an integer value. Try using an expression binding to cast your value as an integer:

 ![Screen Shot 2022-07-18 at 7.47.03 AM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/6/8675d561b2a2642a1865b87d1cd81d5034549cf4.png)

---

<div class="post-metadata">

**Author:** ![pkhoshroo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pkhoshroo/32/26801_2.png) [@pkhoshroo](https://forum.inductiveautomation.com/u/pkhoshroo)\
**Post date:** [November 8, 2024, 5:58pm UTC](https://forum.inductiveautomation.com/t/numericentryfield-allows-decimals-even-if-the-format-is-set-to-integer/61999/4 "2024-11-08T17:58:55Z")

</div>

> [@cmallonee](#):
>
> then you need to supply the Numeric Entry Field an integer value.

How can I make this to not accept decimal value?  
Like for example I want the user to be able to only enter integer values like 2 and not 2.5, is that possible?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 12, 2024, 7:18pm UTC](https://forum.inductiveautomation.com/t/numericentryfield-allows-decimals-even-if-the-format-is-set-to-integer/61999/5 "2024-11-12T19:18:52Z")

</div>

No, you can't stop a user from typing a value which is not an integer. You CAN use a value change script to cast their supplied value to whatever type you want.
