AnsweredAssumed Answered

Creating a constraint for 3 digits after the decimal in Survey123

Question asked by jakethepainter on Aug 6, 2019
Latest reply on Oct 7, 2019 by jakethepainter

I'd like to constrain user input in a decimal field (esri type double) to look like -0.123.  That is: either negative or positive, one digit before and 3 digits after the decimal.

I've got the following regular expression as a constraint:

regex(., '^[-]?\d[.]\d{3}$')


This works, except it won't allow a number like -1.100


The last digit has to be non-zero. If I switch the type of the field to text, it evaluates correctly, but that makes for a much less nice keyboard input on the ipad for the user.  I would like to keep the numeric keyboard.


Any ideas?  I'm fine with allowing -1 or -1.1 but don't want to allow 100.  I would prefer that the user have to type all 3 digits after the decimal.  I prefer to have them type the 0 before the decimal if the value is less than 1, but that's negotiable as well.


Good Values:







Bad values:




-.123 (negotiable)

-1 (negotiable)