Issue submitting time in 9999 format

304
3
04-10-2018 06:49 AM
JohnMarra
New Contributor III

I have a integer field I am trying to use to collect time in military time ie. 0834 or 1334, but only the 2nd time is working. For the 0834 time I get a "field is invalid" error.

I have this line in the constraint column:

(int(substr(.,0,2))<24) and (int(substr(.,3,4))<60)

I also have 4 in the bind::esri:fieldlength column

Does anyone know a workaround for this issue. An input mask will not work for my purposes. Thank you in advance.

0 Kudos
3 Replies
JamesTedrick
Esri Esteemed Contributor

Hi John,

I believe the issue is that you are storing the time as an integer and then using text manipulation functions in your check.  Leading 0's don't matter for numbers, so when you type in 0845, it gets stored as 845; your constraint check will then see the 'hour' check as 84, not 08.  I would suggest that if you want to input time this way, you have a text question; this will preserve the leading 0's.  You can test this by using a value like 0179 -> it gets checked as 17 & 9 and thus passes the constraint.

You should also do a check for overall string length; while you may have the fieldLength (which in this context should only apply to text/string, integers are either long or short, depending on the size values stored), that doesn't prevent someone from entering more text (if that happens, submission fails with a 'string truncated' error).

0 Kudos
JohnMarra
New Contributor III

Is there a way to have the input to a text field only show numbers rather than a full keyboard, as it would if the field were were an integer or decimal field? 

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi John,

You can apply the numbers appearance to the text question to have a numeric keypad display below the field, but it does not alter the keyboard layout.

0 Kudos