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 |
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 |
Thanks Stephanie,
I hate to fess up to my error, but just in case anyone ever refers to this later.. Both forms work OK. My problem was that I forgot to add the namespace prefix for the element I was referring to. instance('submission-response')//elementValue instance('submission-response')//ds:elementValue *headslap* -Ron- 2010-10-20_09:45:37-0400 "Stephanie Hall (TT)" <[hidden email]>: > 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 -- 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 |
2010-10-20_21:26:09-0400 Ron Peterson <[hidden email]>:
> Thanks Stephanie, > > I hate to fess up to my error, but just in case anyone ever refers to this later.. > > Both forms work OK. Not true. Yours is better. My way doesn't discriminate between different submissions. I thought the observer attribute directs an action to pertain to a specific submission, but I apparently don't properly understand the observer attribute yet. -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 |
Free forum by Nabble | Edit this page |