kobotoolbox / enketo-express

We've moved! Please use the new repository 🠊 https://github.com/enketo/enketo-express
Apache License 2.0
102 stars 90 forks source link

OC only: new Participate view #1102

Closed MartijnR closed 6 years ago

MartijnR commented 6 years ago

non-readonly, and non-review(dn)-only view:

these "hard checks" may in the future be combined with regular checks

MartijnR commented 6 years ago

This issue replaces #944.

Possible implementation issue:

some widgets may fire change events when a user is trying to enter a correct value using e.g. keyboard arrows, slider on touchscreens. The change event that sets the value to '' would prevent the user from correcting the value.

MartijnR commented 6 years ago
MartijnR commented 6 years ago

@pbowen-oc I've confused myself wrt to "hard required" (apart from the logic when clicking Close). In this scenario, what is the desired behavior of hard required:

Question A is hard required and currently has a value "a". The user clears the value.

pbowen-oc commented 6 years ago

@MartijnR - I think the value should be cleared and submitted back as null in that case, but the required error message should then be displayed right after (basically, I think this is how it works for required items in general now). Other hard required functionality, like blocking moving to the next page and blocking clicking the Close button, should also be in effect as soon as the error appears.

I need to consider this more and talk about it internally. The more I think about it, the more confused I am. I will get back to you about this.

Regarding hard constraints, if the item has value 5 and the user enters value 11 (which violates the constraint condition), the item will immediately revert to the previous value (5), not null, correct?

MartijnR commented 6 years ago
constraint bind::oc:constraint-type required bind::oc:required-type
. > 5 strict yes strict

(any other value for constraint-type would be ignored)

test form: https://docs.google.com/spreadsheets/d/13prx-MFfcauAmjp5VxjdnRCLNtHK1BEF4xZ1o9Mtf8M/edit?usp=sharing

MartijnR commented 6 years ago

local test form: http://localhost:8005/single/fs/participant/i/::9fab8d28abfc8e0ee51b3744d21963fa?ecid=a

pbowen-oc commented 6 years ago

@MartijnR - We've thought about it more and decided that attempting to clear a strict required item should work in a similar way to attempting to change the value of a strict constraint item to an invalid value.

If an item is strict required and currently has a value and then the user clears the value of that item, it should immediately revert the item to its previous value (without submitting the blank value to OC) and show a popup error message on the form.

If a strict required item is blank on the page, the user should not be able to change pages. If a strict required item is blank anywhere on the form, the user should not be able to use Close/Complete.

MartijnR commented 6 years ago

@pbowen-oc in the common page validation feature, Enketo only requires validation for Next, not for Back. Would you want this custom hard page validation to do the same or block both Next and Back if current page fails hard validation?

pbowen-oc commented 6 years ago

@MartijnR - Yes, we should only block advancing to the next page, not going back to the previous page. If the Go to beginning/end buttons are present, it should similarly prevent going to the end but not going back to the beginning.

MartijnR commented 6 years ago

This work is available for initial testing in develop branch.

MartijnR commented 6 years ago
enketo-issue-mover commented 6 years ago

This issue was moved to OpenClinica/enketo-express-oc#48