What happens when a node is not relevant

Yaw, so just to confirm, when a control's relevant is (or becomes) false, ODK Collect actively blanks out the corresponding XML element value, as opposed to just merely hiding the control in the UI?

I'm (genuinely) curious - is that prescribed W3C XForm behavior, or an ODK/Collect implementation decision?:thinking:

  • Gareth

I don't know where the behavior in is inherited from. @martijnr?

The spec says when the relevance is false() the data node and its descendants are removed on submission, but that's not actually what happens in Collect.

Collect stores the data in memory while the application is open, it persists the relevant values on save, and thus on submission. Not sure what Enketo does and so I've filed an issue at https://github.com/opendatakit/xforms-spec/issues/153 to clarify.

The spec says when the relevance is false() the data node and its descendants are removed on submission, ...

Yup, and that makes sense - no point sending excess data that's been deemed irrelevant. But actually nulling things out (including all descendents!) whilst filling in the form has not insignificant implications. And I could see arguments for both: eg you may not want to immediately null out prefilled data (aka defaults), in case it soon becomes relevant. But when something the user entered, which was relevent but then becomes irrelevant as a consequence of them doing something else later, then you might as well null it out so everything is ready to send.

Dunno... damned if you do, damned if you dont? :slight_smile: