enketo-core icon indicating copy to clipboard operation
enketo-core copied to clipboard

Relevant calculation causes the selected cascade choice to disappear for the first repeat after filling in information within a second repeat.

Open nanzhang01 opened this issue 5 years ago • 2 comments

Describe the bug Relevant calculation causes the selected cascade choice to disappear for the first repeat after filling in information within a second repeat.

To Reproduce

  1. Create survey with this xls form: test.xlsx
  2. Select mon or tue;
  3. Test1 quesiton appeared;
  4. Select a dropdown value, i.e. "maybe";
  5. Create a new repeat;
  6. Select mon or tue in the second repeat, observe that "maybe" is cleared in test1 in the first repeat;

Screenshots 00_bug_screenshot5

nanzhang01 avatar Dec 01 '20 08:12 nanzhang01

Thanks. Looks like a serious bug!

MartijnR avatar Dec 01 '20 16:12 MartijnR

http://localhost:8005/?xform=00_test_bugs.xml

  • [x] check removing calculation - issue does not occur so likely not caused by relevant
  • [x] check removing relevant - haha, also does not occur, so it's some kind of interaction between calc and relevant

I cannot think of any use case where it makes sense to have a calculation on an autocomplete widget, so I am inclined to not spend time on this.

MartijnR avatar Dec 01 '20 17:12 MartijnR

Looks like expected behavior to me. The calculation is re-run and evaluates to '' because neither none nor other is selected. I think this is similar to https://github.com/enketo/enketo-core/issues/880#issuecomment-1101038570. If you'd like a dynamic default you can use something like https://docs.getodk.org/form-logic/#dynamic-defaults-from-form-data. Calculations may be re-evaluated at any time.

lognaturel avatar Sep 29 '22 23:09 lognaturel