Hello,

How can I require that one decimal place is entered for a question on a form?

Ex. This is allowed: '8.1' But this is not allowed: '8' or this '8.11'

Thank you!

Hello,

How can I require that one decimal place is entered for a question on a form?

Ex. This is allowed: '8.1' But this is not allowed: '8' or this '8.11'

Thank you!

This is tricky.

It is far easier to take the user's input and round it up to the nearest

decimal during your analysis or in subsequent computations.

And why is '8' not good? How is it not equivalent to someone entering '8.0'

?

If you must do this, you should probably collect string values -- using the

appearance="numbers" to force the numeric keyboard.

But first double-check that the decimal point is available on that keyboard

for your particular device (the pop-up keyboards vary).

You could then use a regular expression (regex) to force the exact

representation you want. e.g.,

regex(.,'[0-9]+[.][0-9]')

as the constraint for this string value.

If you then needed to use it in a computation, you can do

number(${fieldname})

to convert it to a decimal value. Note that this value might be something

like 8.20000001 due to the inexactness of floating point representations.

Hello,

How can I require that one decimal place is entered for a question on a

form?Ex. This is allowed: '8.1' But this is not allowed: '8' or this '8.11'

Thank you!

## --

Post: opendatakit@googlegroups.com

Unsubscribe: opendatakit+unsubscribe@googlegroups.com

Options: http://groups.google.com/group/opendatakit?hl=en

You received this message because you are subscribed to the Google Groups

"ODK Community" group.

To unsubscribe from this group and stop receiving emails from it, send an

email to opendatakit+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--

Mitch Sundt

Software Engineer

University of Washington

mitchellsundt@gmail.com