Read_only - how to set dynamically

Hello,
we try to set read_only dynamically (with an expression), but - different to relevant and required - this doesn’t seem to work. See attached examples.
Is this not implemented in KoBoCollect?
Furthermore, it seems that read_only is not available in (Enketo) Online FormBuilder.
Thanks.

read_only dynamic 02.xlsx (10.0 KB)

Here are links to the specs:
https://opendatakit.github.io/xforms-spec/#bind-attributes

readonly
As in XForms 1.0 this specifies whether the user is allowed to enter data, using a boolean expression. Considered false() if omitted.

https://www.w3.org/TR/2003/REC-xforms-20031014/slice6.html#model-prop-calculate
6.1.2 The readonly Property*
Description: describes whether the value is restricted from changing.
Computed Expression: Yes.
Legal Values: Any expression that is convertible to XPath boolean with boolean().
Default Value: false(), unless a calculate property is specified, then true().

Hello,
still need support on this question, please.
Find attached some exercises without being able to set read_only dynamically.
Read_only Dynamic 02.xlsx (10.6 KB)

Can anyone provide an example where dynamic setting s working for read_only, please.

I copy in @Xiphware as he earlier mentioned read_only is working dynamically here:
Dynamic Constraint Message (Logic expression) >> post 3

Maybe this issue needs to be forwarded to development? @jnm
It is necessary to allow read_only to be set dynamically. Just an example: If a birth date is recorded, age can be calculated (set to read_only = yes), otherwise age has to be entered…

The finding might be related with this topic:

Thanks in advance.
Kind regards
Wolfgang

Sorry, I misspoke - Enketo does not yet support runtime re-evaluating XPath read-only bindings. See https://enketo.org/about/roadmap/ (“Dynamic readonly”)

Actually, after a bit more digging, Enketo doesn’t actually evaluate the readony XPath expression (!). Rather, presently it just checks whether the string is “true()” or not. So, for example, if you put read_only as “1=1” - which is always true - it will not work as expected.

If interested, Enketo issue is being tracked here: https://github.com/enketo/enketo-core/issues/391

1 Like

Hello,
you are welcome. @Xiphware: Also KoBoCollect does NOT support??
(Different to XLSForm spec.)…
Should be addressed to the developers, please. (Since Feb. no news there).

**I there a summary list, which standard XLSForm elements from the official spec (XLSFom.org) are yet NOT implemented in KoBoCollect (or differently) **

Have a nice day.
Wolfgang