Closed MartijnR closed 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.
validatePage
setting in participant viewsvalidateContent
function that looks at strict logic only.invalid-constraint [oc-constraint-type="strict"], .invalid-required [oc-required-type="strict"]
are found!@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.
@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?
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 - 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.
@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?
@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.
This work is available for initial testing in develop
branch.
This issue was moved to OpenClinica/enketo-express-oc#48
non-readonly, and non-review(dn)-only view:
these "hard checks" may in the future be combined with regular checks