Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On relevance being false(), the data node is removed on save, not submission #153

Open
yanokwa opened this issue Nov 8, 2017 · 7 comments

Comments

@yanokwa
Copy link
Member

yanokwa commented Nov 8, 2017

The spec says when the relevance is false() the data node and its descendants are removed on submission. ODK Collect stores them in memory while the application is open, it persists the relevant values on save and thus on submission. Not sure what Enketo does and that's why I've filed this issue.

@MartijnR
Copy link
Contributor

MartijnR commented Nov 8, 2017

In Enketo Express, the irrelevant nodes are removed (not just emptied) when the record is saved as final and can no longer be edited. So this is not upon submission either. Irrelevant nodes are kept when the record is saved and not marked as final.

So it sounds like we do the same (right?) and should edit the spec.

@tiritea
Copy link

tiritea commented Nov 9, 2017

So while a form is actively being filled out, irrelevant nodes are not removed, correct? So, if the node is not removed, are their values 'blanked' in some way instead? Which is to say, if something irrelevant subsequently becomes relevant does their previous (eg default) value remain?

@MartijnR
Copy link
Contributor

MartijnR commented Nov 9, 2017

So while a form is actively being filled out, irrelevant nodes are not removed, correct?

Yes, correct.

So, if the node is not removed, are their values 'blanked' in some way instead? Which is to say, if something irrelevant subsequently becomes relevant does their previous (eg default) value remain?

Good question. This is messy in Enketo for historic reasons. Enketo used to keep those nodes and their values untouched until the record was marked as final. At some point, we realized that was wrong and that they should be cleared immediately. This is what the spec should say I think, but would like to hear what others think, and what ODK Collect does.

Unfortunately, by the time we realized this, users had started relying on that incorrect behavior so this is now implemented as a special 'mode' Enketo can run in. Some Enketo applications clear the values immediately to <a></a>, some don't. Clearing immediately is the default of the form engine but in the main Enketo application used by Ona and KoBoToolbox, this is overridden.

@chrislrobert
Copy link

chrislrobert commented Nov 9, 2017 via email

@tiritea
Copy link

tiritea commented Nov 9, 2017

Another 'issue' with automatically clearing irrelevant nodes is that you effectively loose the ability to pre-populate defaults for (initially) non-relevant properties. By definition, if a node is irrelevant on startup then it should also be wiped - otherwise you rather end up with inconsistent enforcement of the prescribed cleared-if-irrelevant behavior...

So I'm probably leaning towards Chris: its OK to choose not to upload irrelevant properties on form submission (and hide any corresponding control in the GUI). But beyond that yer probably opening pandoras box... :-)

@MartijnR
Copy link
Contributor

MartijnR commented Nov 9, 2017

Yes, the accidental data loss is a valid concern. I'll try to find the arguments for introducing the 'clear immediately mode' a while back, but we could probably defend both ways.

@lognaturel
Copy link
Member

lognaturel commented Mar 9, 2022

Looks like this was never made explicit.

  • Non-relevant values including calculates in non-relevant blocks are treated as null in expressions (that is, nodes that users don't see and that will be pruned on finalization are treated as though they weren't there)
  • calculates still update even when in non-relevant blocks
  • controls that had a value, became non-relevant, and then became relevant again have their values restored

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants