I'm doing a GET submission that either returns a normal instance
document or an error instance document. The two have completely different XML structures. I'm currently keeping the returned instance document in a temporary instance until I figure out if it was a success or a failure. The problem is, I don't know how to take different actions based on what I get back, or where to specify it. I found xforms-submission-done and -error events, but where would I specify the action to take when one of those events occurs? It seems like a bad idea to put the action inside of both the trigger and the select1 that can cause the submission. Is there a way to specify an action in just one place that will copy (or insert) the instance document into another xforms:instance when the submission succeeds? Another twist on this problem: I have multiple instance documents that should probably use the same pattern. How do I examine each submission response and copy it to the correct instance document on success? Thanks, -Jim -- 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 |
Administrator
|
You can use the @if attribute to make a decision, e.g.:
<xforms:action if="success condition" ev:event="xforms-submit-done"> ... </xforms:action> <xforms:action if="failure condition" ev:event="xforms-submit-done"> ... </xforms:action> You have 2 event handlers, but each will only execute based on its condition. Or, you can do it with one event handler and nested actions: <xforms:action if="success condition" ev:event="xforms-submit-done"> <xforms:action if="success condition"> ... </xforms:action> <xforms:action if="failure condition"> ... </xforms:action> </xforms:action> -Erik On Jun 16, 2008, at 11:01 PM, Jim Logan wrote: > I'm doing a GET submission that either returns a normal instance > document or an error instance document. The two have completely > different XML structures. I'm currently keeping the returned > instance document in a temporary instance until I figure out if it > was a success or a failure. The problem is, I don't know how to take > different actions based on what I get back, or where to specify it. > I found xforms-submission-done and -error events, but where would I > specify the action to take when one of those events occurs? > > It seems like a bad idea to put the action inside of both the > trigger and the select1 that can cause the submission. Is there a > way to specify an action in just one place that will copy (or > insert) the instance document into another xforms:instance when the > submission succeeds? > > Another twist on this problem: I have multiple instance documents > that should probably use the same pattern. How do I examine each > submission response and copy it to the correct instance document on > success? > > Thanks, > -Jim > > > -- > 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 Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- 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 |
Erik Bruchez wrote:
> You can use the @if attribute to make a decision, e.g.: > > <xforms:action if="success condition" ev:event="xforms-submit-done"> > ... > </xforms:action> > <xforms:action if="failure condition" ev:event="xforms-submit-done"> > ... > </xforms:action> > > You have 2 event handlers, but each will only execute based on its > condition. > > Or, you can do it with one event handler and nested actions: > > <xforms:action if="success condition" ev:event="xforms-submit-done"> > <xforms:action if="success condition"> > ... > </xforms:action> > <xforms:action if="failure condition"> > ... > </xforms:action> > </xforms:action> > > -Erik Thanks, -Jim -- 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 |
Administrator
|
Jim,
On Mon, Jun 16, 2008 at 2:44 PM, Jim Logan <[hidden email]> wrote: > Great! Where can I put the action(s)? Head? Body? Outside of all other > xforms elements? You can use the "if" attribute on <xforms:action> and on any other action to make it conditional. Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ Personal Blog: http://avernet.blogspot.com/ Twitter - http://twitter.com/avernet -- 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 |
Alessandro Vernet wrote:
> Jim, > > On Mon, Jun 16, 2008 at 2:44 PM, Jim Logan <[hidden email]> wrote: > >> Great! Where can I put the action(s)? Head? Body? Outside of all other >> xforms elements? >> > > You can use the "if" attribute on <xforms:action> and on any other > action to make it conditional. > > Alex > -- 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 |
Jim,
> But where is it legal to put the action itself? the specification contains two tables listing the elements and their content model: http://www.w3.org/TR/xforms11/#structure-abstract http://www.w3.org/TR/xforms11/#controls So, the action element seems to be allowed in the model, instance and submission elements, and in all "Core Form Control Elements" because it's part of the "UI Common" Content set: http://www.w3.org/TR/xforms11/#elems-ui-common But i'm not sure whether this is exhaustive. HTH florian -- 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 |
Florian Schmitt wrote:
> Jim, > >> But where is it legal to put the action itself? > > the specification contains two tables listing the elements and their > content model: > > http://www.w3.org/TR/xforms11/#structure-abstract > http://www.w3.org/TR/xforms11/#controls > > So, the action element seems to be allowed in the model, instance and > submission elements, and in all "Core Form Control Elements" because > it's part of the "UI Common" Content set: > http://www.w3.org/TR/xforms11/#elems-ui-common > > But i'm not sure whether this is exhaustive. > > HTH > florian > > -- 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 |
In reply to this post by Jim Logan-3
I'm wondering whether someone can help. I'm trying to solve the same problem right now!
So I've got a submission that works - and some xml is returned to an instance called 'submit-results'; I know xforms-submit-done fires because I've been triggering a javascript function when it happens. I can also see in the instance inspector that the 'correct' or 'incorrect' results are being returned to the 'submit-results' instance. So from reading this thread I think I've understood that you can put if statements inside a submission block? So I've been trying something like this: <xf:submission id="formsubmission" method="post" action="https://myserver/formsubmission" ref="instance('my-main-instance')" replace="instance" instance="submit-results"> <xf:action if="instance('submit-results')//data/document-id/text()" ev:event="xforms-submit-done"> <xxforms:script ev:event="xforms-submit-done">pleaseWait('done');</xxforms:script> </xf:action> <xf:action if="instance('submit-results')//data/error/text()" ev:event="xforms-submit-error"> </xf:action> </xf:submission> So if I've understood this correctly, the if statement is checking for the presence of nodes inside the instance and should throw the event (either xforms-submit-done or xforms-submit-error) based on what comes back.. Nothing is being triggered if I do this although the XML gets into the instance. Can anyone help me with this? Thanks very much in advance :) A |
Solved the problem :)
For anyone who may be interested, here's what I'm doing: The submission returns an XML document that either contains: <data> <error /> </data> Or <data> <document-id /> </data> In both cases, an xforms-submit-done event fires. Using the if statements - as suggested in this post - I'm now checking for the absence of either an <error /> or a <document-id /> and triggering a javascript function depending on the result. I hope this helps others on the forum: <xf:submission id="formsubmission" method="post" action="https://myserver/formsubmission" ref="instance('my-main-instance')" replace="instance" instance="submit-results"> <xf:action if="not(instance('submit-results')//error)" ev:event="xforms-submit-done"> <xxforms:script ev:event="xforms-submit-done">pleaseWait('done');</xxforms:script> </xf:action> <xf:action if="not(instance('submit-results')//document-id)" ev:event="xforms-submit-done"> <xxforms:script ev:event="xforms-submit-done">pleaseWait('error');</xxforms:script> </xf:action> </xf:submission> |
Administrator
|
In reply to this post by fl.schmitt(ops-users)
> So, the action element seems to be allowed in the model, instance
> and submission elements, and in all "Core Form Control Elements" > because it's part of the "UI Common" Content set: > http://www.w3.org/TR/xforms11/#elems-ui-common Actually, I don't think it is legal to put an action within xforms:instance, especially when you specify an inline instance document (in fact, I will check with the XForms Working Group about this). Certainly, this is not allowed with Orbeon Forms at the moment. But you are right about the rest! In theory, you should be able to place actions also within XHTML elements as well, assuming you use the ev:observer or ev:target attributes, but at the moment we do not support such a loose placement of actions. So for now you should place such elements within xforms:model, xforms:submission, and directly within XForms controls. -Erik -- Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- 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 |