Hello !
In one of your form we have an instance that holds a Boolean value, we base
all high level bindings (except that of the control that handles the Boolean
value) of the form off that value. for example:
<xf:instance id="isCompleteInstance">
<isComplete/>
</xf:instance>
<xf:bind ref="instance('fr-form-instance')/discharge-plan-gp"
readonly="instance('isCompleteInstance') = 'true'/>
Now I have a check box the enables and disables the read only part of the
binding with the following select (check box) control
<xf:select appearance="full"
id="isComplete-control"
ref="instance('isCompleteInstance')">
<xf:label ref=""/>
<xf:hint ref="/>
<xf:help ref=""/>
<xf:alert ref=""/>
<xf:itemset nodeset="$form-resources/control-76/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
</xf:itemset>
<xf:action ev:event="xforms-value-changed">
<xf:setvalue if=".='false true'" ref="." value="'true'"/>
</xf:action>
</xf:select>
this all works fine. So once you tick the check box the whole form (except
the check box) becomes read only. Now once we submit the form we want to
copy the value of the "isCompleteInstance" instance to the form data. We are
doing this by doing the following action.
<xf:setvalue ev:event="fr-data-save-prepare"
ref="instance('fr-form-instance')/isComplete"
value="instance('isCompleteInstance')"/>
Now, when the form loads we want to copy the value in the form to the
instance so it remains read-only, we do this with
<xf:setvalue ev:event="xforms-ready"
ref="instance('isCompleteInstance')"
value="instance('fr-form-instance')/isComplete"/>
All of this works fine! We have a check box that we can select when to make
the form read only, when we are creating it, but we can deselect it if we
make a mistake and can change it before saving the form, once saved with the
check box selected, the form can never be edited again.
Works great!
However, there is an issue with the event /fr-data-save-prepare/ event with
auto save. Say we select the check box the makes out form read only, and an
auto save happens. The /fr-data-save-prepare/ is triggered! which causes the
check box to go read-only! Which is not the desired out-come, as the person
my not be finished with the form even when the check box was selected!
Is there any event that I can use that is only triggered when the save
button is pressed but after the validation has been passed? Also not
triggered on auto save events..
Thanks for your time!
Any issues with my explanation let me know!
Joel.
--
Sent from:
http://discuss.orbeon.com/