# Restrict decimal point to one

**URL:** <https://forum.getodk.org/t/restrict-decimal-point-to-one/45987>\
**Category:** Support\
**Tags:** odk-xlsform\
**Created:** [March 26, 2024, 9:29am UTC](https://forum.getodk.org/t/restrict-decimal-point-to-one/45987 "2024-03-26T09:29:39Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![wroos](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/w/77aa72/32.png) [@wroos](https://forum.getodk.org/u/wroos)\
**Post date:** [March 26, 2024, 7:40pm UTC](https://forum.getodk.org/t/restrict-decimal-point-to-one/45987/2 "2024-03-26T19:40:53Z")

</div>

Maybe the search function of this forum can help you, incl. examples, see [https://forum.getodk.org/search?q=regex%20decimal%20digits](https://forum.getodk.org/search?q=regex%20decimal%20digits), esp. [Regex on decimal numbers with .0 e.g. 38.0](https://forum.getodk.org/t/regex-on-decimal-numbers-with-0-e-g-38-0/43868).

Hints:  
As far as I know, for decimal type, you cannot avoid that 12.0 will finally be shown as 12. (Also, this is mathematically the same value.)

You cannot restrict directly inside/during the field entry, only after the focus is moved outside (check via constraint).

For regex constraints, you can find more here: [https://docs.getodk.org/form-regex](https://docs.getodk.org/form-regex). You can use a decimal or integer type and cast it with string(${myNumberVar}) for the regex expression.

---

_[View the full topic](https://forum.getodk.org/t/restrict-decimal-point-to-one/45987)._
