System requesting an integer number when user inputing decimal number to a field with decimal datatype

I have a field with decimal data type. When user input a decimal number and click next, error shows up requesting a value that has no decimal separator. User is able to move to different field by manually clicking the next field, but there is no guarantee that the previous field’s value stored as decimal. Below is the image.


unknown-2

  1. Is it a normal behaviour? Does the decimal value will be stored as decimal despite the error?
  2. What is the correct type on survey sheet for inputing a decimal/float value?

Any help would be very appreciated

This is weird! We use the decimal type and usually it behaves just fine. One thing to double check is whether the model statement has a different type, like integer, or somewhere else in the survey, for this variable. Does it happen for all the decimal variables or just this one? Are there any additional attributes applied?

We haven’t run into the exact decimal issue, but sometimes have run into issues with language settings, where depending on how a particular tablet level language setting does dates or something it caused an issue. I know some countries use . or , for decimals so that might be worth double checking in the tablet settings.

1 Like

You can increase the resolution of the field by adding an inputAttributes.step column to your prompt. Looks like some devices have a default resolution of 1 and others have a default resolution of 0.1.

See here for documentation on inputAttributes
https://docs.odk-x.org/xlsx-converter-reference/?highlight=inputattributes#optional-columns

See here for documentation on step
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number#htmlattrdefstep

3 Likes

Thanks @elmps2018 and @linl33 for the insight. This decimal issue is happened in all forms that using decimal prompt type. I assumed my tablet is using . for decimal since if I open the default calculater app, the default decimal separator is .

I currently doesn’t use additional attributes when I post the questions.

As mentioned by @linl33, I added inputAttributes.step column and set the value to 0.001. Sadly, the problem persist. Below is my forms (it’s a very short forms and the model that has decimal type is initialized on this form, not from other forms).

survey_2_ba_draft_heel.xlsx (18.8 KB)

Any additional input will be appreciated :slight_smile: , I’ve been strugling to fix this problem this past couple weeks.

There is a leading space in your inputAttributes.step column. Fixing that should solve your problem.

3 Likes

You’re right! thanks for pointing that out :wink:

2 Likes