OpenClinica / enketo-oc

OpenClinica's fork of the Enketo web forms monorepo
Apache License 2.0
0 stars 1 forks source link

"hidden item" error when opening a form #26

Open malcjackson opened 7 months ago

malcjackson commented 7 months ago

Describe the bug After entering data in a form in OC, reopening it results in an inappropriate "hidden item" error

To Reproduce Add the attached form to a study Enter data and close the form Reopen the form in the attached instance in endpoint /edit/fs/dn/i/ Issue720Instance.txt

Expected: The form reopens with no warnings or errors Actual: The attached "the item you are trying to edit is hidden" error appears

Screenshots image

Browser and OS (please complete the following information):

Windows, Chrome

Xform of the affected form: xform_contactdata_hiddenerror.txt

malcjackson commented 7 months ago

Updated with additional details on instance and endpoint used in this case

MartijnR commented 7 months ago
curl --user enketorules: -d "server_url=http://localhost:3000&form_id=xform_contactdata_hiddenerror&ecid=1&instance=\
<data xmlns:oc=\"http://openclinica.org/xforms\"  xmlns:enk=\"http://enketo.org/xforms\" ><diagnosis>None</diagnosis><middle>a</middle><street1>b</street1><street2>c</street2><country>d</country><city>e</city><state>f</state><pcode>g</pcode><fdob>h</fdob><hnumber>i</hnumber><meta><instanceID>uuid:1234</instanceID><instanceID_comment></instanceID_comment></meta><street2_comment></street2_comment><city_comment></city_comment><state_comment></state_comment><diagnosis_comment>{\"queries\":[],\"logs\":[{\"type\":\"audit\",\"message\":\"Value changed from \\\"\\\" to \\\"None\\\"\",\"user\":\"siteuser1\",\"date_time\":\"2023-11-06 21:18:03.814 Z\"}]}</diagnosis_comment><street1_comment></street1_comment><fdob_comment></fdob_comment><hnumber_comment></hnumber_comment><pcode_comment></pcode_comment><country_comment></country_comment><middle_comment></middle_comment></data>\
&instance_id=a" http://localhost:8005/oc/api/v1/instance/note/

Findings

Enketo scrolls to the first non-readonly question, which in this case is a non-relevant dn. Not sure if this is a regression or an unusual case.

To Do

pbowen-oc commented 7 months ago

@MartijnR - If we don't pass in a URL parameter identifying a specific item to open to, the expectation is that it simply opens to the top of page 1. If it is doing something different, I think there has been a regression.

MartijnR commented 7 months ago

Thanks! Yes, I confirmed now that it is a regression in Enketo Core 7.2.3 (May 2023) https://github.com/enketo/enketo-core/pull/969

Thankfully, it looks like the fix in my PR restores the original behavior though the goto functionality would require special attention during testing.

pbowen-oc commented 7 months ago

@MartijnR - This is not working. We are still seeing the error. We also noticed that it is skipping the first page of a form when it only contains a note and going right to page to with input fields (no relevant logic in use and no goto item in use).

Using /single/fs/i/ the following form opened directly to the second page unexpectedly: multi-level_crf_v1-sm-v2.xform.txt

MartijnR commented 7 months ago

If you are still seeing the error, I would expect there to be a hash (#) part in the URL (which would mean OC requested the goto functionality). Could you post an Enketo URL please?

Wrt loading the second page, I'll try to reproduce.

pbowen-oc commented 7 months ago

We are not seeing the error anymore. Our deployment was outdated. However, the issue with page 1 being skipped is still occurring.

MartijnR commented 7 months ago

The bug is present in any form whose discrepancy notes start on a page other than the first page. The form will load to that page.