enketo-core icon indicating copy to clipboard operation
enketo-core copied to clipboard

readonly should be dynamic

Open MartijnR opened this issue 8 years ago • 5 comments
trafficstars

But do not rush to implement this as it has never been requested.

MartijnR avatar Dec 09 '16 23:12 MartijnR

It has now been requested (for Survey123).

MartijnR avatar Oct 02 '18 20:10 MartijnR

One way to implement this is to add to evaluation cascade and use evaluation result to set the readonly boolean attribute on the original form control. The expression would be stored in the data-readonly attribute during XSL transformation.

  • [ ] in enketo-xslt copy readonly expression to data-readonly attribute (like relevant, calculate, required) and do not set the readonly attribute.
  • [ ] in enketo-core add to evaluation cascade and set readonly atttribute
  • [ ] in widgets-controller (or elsewhere), do an additional check whenever calling the widget enable function as the question has to 1) be relevant and 2) not be readonly
  • [x] turn the readonly property from get props() in the Widget super class to a getter function
  • [ ] check all props.readonly usage in all widgets to remove assumptions that this condition is static

MartijnR avatar Apr 01 '19 20:04 MartijnR

minor comment (and so that I'll get pinged on future updates) that the readonly binding doesn't appear to get evaluated as an XPath expression per se, rather just a static check to see if the string is "true()" or not (case insensitive?). Perhaps initially evaluating this (once) using XPath processor instead could be an easier initial step forward?

tiritea avatar Nov 07 '19 20:11 tiritea

Yes, that would be a good first step. Thanks!

MartijnR avatar Nov 08 '19 18:11 MartijnR

This is a feature would also be nice for us

kryptt avatar Jan 13 '21 09:01 kryptt