Per XForms semantics the readonly Model Item Property is inheriting: if a
fx-bind
marks a node as readonly, every descendant node inherits that state too - even though none of them
carry a readonly attribute of their own.
Below a single fx-bind on the address node drives readonly dynamically from a
sibling view flag:
<fx-bind ref="address" readonly="if (../view = 'true') then true() else false()"></fx-bind>
The three controls for street, city and zip have no
binding of their own - they simply inherit the readonly state from their address
parent. Toggle the button to switch the whole group between readonly and readwrite.
Current view value:
Only address has an explicit readonly expression. When view is
'true', address becomes readonly, and every node underneath it -
street, city, zip - reports readonly as
true as well, purely by walking up the instance tree to the nearest ancestor with a
ModelItem. No binds, and no manual propagation, are needed on the children.
The same inheritance rule applies to relevant: a node is only relevant if it is relevant
itself and all its ancestors are relevant too.