OpenClinica / enketo-oc

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

Look into whether ecid can be influenced by another tab #61

Open MartijnR opened 1 year ago

MartijnR commented 1 year ago

For submitting a complete record (without any validation logic) for a form that has validation logic and would not accept an empty record as 'complete'.

Has nothing to do with offline-capable forms.

Manually changing the ecid would allow one to reproduce this, but the questions whether Enketo can get confused and use the wrong ecid.

MartijnR commented 1 year ago
  1. ecid value is read on the client here: https://github.com/OpenClinica/enketo-express-oc/blob/master/public/js/src/module/settings.js#L45
  2. ecid is added to fieldsubmission/complete URL here: https://github.com/OpenClinica/enketo-express-oc/blob/master/public/js/src/module/field-submission-queue.js#L18-L23
  3. on the Enketo server it is handled here: https://github.com/OpenClinica/enketo-express-oc/blob/master/app/controllers/fieldsubmission-controller.js#L55-L61
  4. which uses the complete function here: https://github.com/OpenClinica/enketo-express-oc/blob/master/app/controllers/fieldsubmission-controller.js#L74
  5. which copies the ecid value here: https://github.com/OpenClinica/enketo-express-oc/blob/master/app/controllers/fieldsubmission-controller.js#L107
MartijnR commented 1 year ago

I have not been able to find a bug in Enketo that would allow ECID values to be incorrectly added to /fieldsubmission/complete calls. They seem to always be taken from the query parameter in the current Enketo form URL.

I have not looked into any possible interaction with offline-capable form URLs.