Open pbowen-oc opened 3 years ago
http://localhost:8005/single/fs/i/2nmkflnC?ecid=1
The issue is that the previous value (any static defaults) cannot be determined by the widget.
The reason this works for some questions atm, is because in the past OC did not use defaults and the initial value was therefore considered to always be empty.
Looks like the elements inside repeats no longer exist by the time the fakeInputUpdate events are fired
This is one of the key issues, and a fundamental flaw in the repeats module. The odk-instance-first-load event fires before the repeats are initialized.
There is also an issue with repeats that get a second event that sets the value back to ""....
* [ ] figure out why that second event is fired (maybe clearing values in template?)
This requires a very thorough overhaul of the repeat module in Enketo Core. It is not pragmatic to do this since OC is using a branch of Enketo Core.
The issue is not with the core functionality but only with generating audits (which OC doesn't store, but regenerates on the server).
Implementation notes (to self):
It requires not removing the first repeat view (unless necessary for jr:count). However the current implementation is lean and robust because we remove the first repeat view. The numbering/datalist/radiobutton processing could be done in a separate function that could be called for the (unremoved) first repeat view instance. However, a lot tests fail when doing this, because of forms that do not have a first model repeat instance.
To investigate: Perhaps the whole audit feature should be rewritten and be directly linked with fieldsubmissions that are sent.
@MartijnR - Given your comments above about the complexity and since the lack of in-session auditing in this case is compensated for by OC, I think this might be good to leave until after our next release.
The revised approach sounds like a good fit for our model. I think we should do this following our next release. We'll note the current behavior as a known issue in the meantime.
Initially added as a comment for OpenClinica/enketo-express-oc#419
Preview mode Steps:
Open the attached form in preview mode - dynamicdefaulthistory.xml.txt
Note that the dynamic defaults are populated for all items as expected
Click the Query Widget for one of the items
Expected: The item value change from null to the default will be listed.
Actual: There is no history.
Field submission mode Steps:
Expected: The item value change from null to the default will be listed.
Actual: There is no history.
Note that in edit mode, the items not in the repeating group do show the history as expected.