We know we can clear data in specific fields using actions using something like this:
<xf:setvalue xxf:iterate="//SomeSection//*[empty(*)]" value="if (//SomeField = 'SomeValue') then '' else ."/>
However, this gets very complicated when there are multiple paths a user can take through a form, and they may go back and change values, which then hide fields which were previously populated (which we do not want).
So how do we clear all the values from hidden fields each time we SAVE or SUBMIT a form?
Thanks in advance.
PeteA
There currently is a request for enhancement to have this done out-of-the-box (#3152). However, if you need to do this in XForms, then you could try something along the lines of the following
<xf:setvalue>(also see #2760).PS: Per #3152, we would like this clearing to happen when users save or submit the data, so fields are not cleared while users are interacting with the form, so if a field becomes hidden, and then is shown again, the value for that field isn't lost. However, since you're looking at doing this in XForms, clearing fields right away as they become hidden might be the best we can do.