Posted by
Stephanie Hall (TT) on
URL: https://discuss.orbeon.com/conditional-action-on-submission-response-tp3003751p3003894.html
Hi Ron,
Try putting both of your if statements inside the same action inside the submission. So:
<submission>
<xforms:action ev:event="xforms-submit-done">
<xforms:action if="string-length(instance('submission-response')//elementValue) > 0">
<xforms:message level="modal" ev:event="DOMActivate">Non-Empty String</xforms:message>
<xforms:toggle case="case-non-empty" />
</xforms:action>
<xforms:action if="string-length(instance('submission-response')//elementValue) = 0">
<xforms:message level="modal" ev:event="DOMActivate">Empty String</xforms:message>
<xforms:toggle case="case-empty" ev:event="DOMActivate" />
</xforms:action>
</xforms:action>
</submission>
And when the xforms-submit-done action fires, the if statements will be evaluated and only the contents of the correct statement should fire.
Hope that helps,
Stephanie
-----Original Message-----
From: Ron Peterson [mailto:
[hidden email]]
Sent: Wednesday, October 20, 2010 7:19 AM
To:
[hidden email]
Subject: [ops-users] conditional action on submission response
Hi,
I'm trying to conditionally respond to a submission response according to the value of one of the response instance's element values. This is what I have now, but the second action is the only one that ever fires.
(I'm 99% certain that I am in fact sometimes returning a non-empty elementValue - I'm going to trace that to be sure later today..)
<xforms:action ev:event="xforms-submit-done"
observer="mysubmission"
if="string-length(instance('submission-response')//elementValue) > 0">>
<xforms:message level="modal" ev:event="DOMActivate">Non-Empty String</xforms:message>
<xforms:toggle case="case-non-empty" />
</xforms:action>
<xforms:action ev:event="xforms-submit-done"
observer="mysubmission"
if="string-length(instance('submission-response')//elementValue) = 0">
<xforms:message level="modal" ev:event="DOMActivate">Empty String</xforms:message>
<xforms:toggle case="case-empty" ev:event="DOMActivate" />
</xforms:action>
So I guess I'm wondering why this doesn't work. I'm also curious how other folks would do this. Is there a common pattern for doing an 'else' action, or is the pattern to simply create two mutually exclusive 'if' actions?
TIA
-Ron-
--
You receive this message as a subscriber of the
[hidden email] mailing list.
To unsubscribe: mailto:
[hidden email]
For general help: mailto:
[hidden email]?subject=help
OW2 mailing lists service home page:
http://www.ow2.org/wws