Invalid calculation value initially shown in Collect

Description

Another type with an invalid calculation behaves strange and inconsistent in Collect, may even crash the form. For example type integer with calculation “text”.

Steps to Reproduce

  1. Upload and deploy XLSForm
    Calc_Invalid01.xlsx (12.1 KB)

  2. Open Navigation tree - and see that the calculation shows the “text” for all fields

  3. Move directly to the END from Navigation and finalise form - a quick not really visible error message will appear (for the date field) in the background, but the form will be saved.

  4. Edit the form again or a new one

  5. Move through the fields (without changing) - and see the “text” in the integer field. The inteer fields will not create an error (but may become empty when you move back)!

  6. The date field will be skipped!, but creates an error which will only appear in the following page (which is confusing for a user).

  7. Say ok - and look again at the Navigation tree. Strange things happened: The 2 integer fields are now empty (you have seen them with “text”.

Expected behavior

UI should not present invalid calculations. As it works fine in Enketo.

Actual behavior

Step 2

Step 5


Step 6

Step 7

Moving more around sometimes even crashed the form (caused by the date format issue probably)

Behaviour was be similar without the DATE field. But then without any error message.

Additional details

Firefox browser, ODK Collect v2022 1.0, Samsung smartphone Android 11

Things work as expected in Enketo (Online validator or KoBoToolbox)
Initially


On validation (or submit)

Also submission works fine here (KoBoToolbox).
Unfortunately, we do not get any hint that there are format inconsistencies with the calculation.

I cc: @Xiphware as this is probably an ODK issue.

Re-tested: Issues are still the same for (ODK) Collect 2023.3.

If you use default instead of calculation, it works well (for ODK): the invalid default values are not set. But there is no error message or warning from the Online validator. And there is special problem in KoboToolbox, when the default contains brackets, see Default with brackets gives deployment error (Kobo Collect).