Default=0 not always replaced when a value is entered

752
1
12-17-2020 08:06 AM
LeonardBarnhill
Occasional Contributor

I have several questions of type decimal with a default value of "0" (zero). This displays properly on the form but when the user enters a value, sometimes the 0 (zero) is overwritten with the new value and sometimes the 0 remains - the result is 012 instead of 12.  This does not affect calculations in the form but is inconsistent for the user.  How do I set this so that it always overwrites the default 0 (zero)?

As a follow up, setting the default value to 0 (zero) also does not work in calculations if the group is not opened.  How can I write the calculation so that the default value of 0 is used even if the group is not opened?

 

0 Kudos
1 Reply
by Anonymous User
Not applicable

Hi @LeonardBarnhill,

I beleive I answered this in your other post earlier today, here is what I wrote:

This is due to the different question types and fieldTypes you are using. 03 is not a valid integer value, so in that case the 0 is removed to make it valid on data entry. However 048 is actually a valid double value, so there is no way to tell if you meant to leave the 0 there or not. When you click into a field, the cursor is moved to the end in case you need the existing values, especially if editing data. You can press the clear button to remove all values, or highlight the existing values with mouse or press and hold.

One other way to avoid this is to not use the default value of 0, and make it required so the user has to enter a valid value, 0 or the actual number. Or use a calculation, instead of default, that only puts the 0 there is needed, otherwise leaves it blank for user to enter a value, and you can make it required based on expression also.

As for your second questions, default values are only loaded on the initial form load, so if you have groups or repeats that are not visible when the form first loads, depending on the order or operation and when values are laoded into questions, it may be better to use a calculation not a default. You can use the same expression or value in the calculation column, instead of using default. That way it will also be calculated when anything changes in the form that it replies on, not just a intial form load.

Regards,

Phil.

Regards,

Phil.

0 Kudos