Multiple submissions: Stop on error

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple submissions: Stop on error

weyer-2
Hello again,

in one of my forms I want to request multiple XPLs by klicking one trigger.
Let's take the folowing simplified example:

...
  <!-- save the current data-instance in the existing xml file -->
  <xforms:submission id="save-submission" ref="instance('data-instance')"
replace="none" method="post" action="/services/savexml"/>
  <!-- release the document (set db flag) by calling an ejb method -->
  <xforms:submission id="release-submission" ref="instance('meta-instance')"
replace="none" method="post" action="/services/release-document"/>
...
  <xforms:trigger appearance="button"
      ref="instance('buttons-instance')//save">
    <xforms:send ev:event="DOMActivate" submission="save-submission"/>
    <xforms:send ev:event="DOMActivate" submission="release-submission"/>
    <xforms:label>Save</xforms:label>
    <xxforms:script ev:event="DOMActivate">window.close();</xxforms:script>
  </xforms:trigger>
...

When the button is pressed the two XPL services will be called and the popup
window will be closed. That works fine ... unless there's an error in one of
the two submissions.

My question:

Is it possible, to stop the trigger from processing send#2 and the script if an
error occures in send#1? If there's an Exception while saving the file, the
document should not be released and the window must not be closed.


--
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
Reply | Threaded
Open this post in threaded view
|

Re: Multiple submissions: Stop on error

marc-62
[hidden email] a écrit :

> Hello again,
>
> in one of my forms I want to request multiple XPLs by klicking one trigger.
> Let's take the folowing simplified example:
>
> ...
>   <!-- save the current data-instance in the existing xml file -->
>   <xforms:submission id="save-submission" ref="instance('data-instance')"
> replace="none" method="post" action="/services/savexml"/>
>   <!-- release the document (set db flag) by calling an ejb method -->
>   <xforms:submission id="release-submission" ref="instance('meta-instance')"
> replace="none" method="post" action="/services/release-document"/>
> ...
>   <xforms:trigger appearance="button"
>       ref="instance('buttons-instance')//save">
>     <xforms:send ev:event="DOMActivate" submission="save-submission"/>
>     <xforms:send ev:event="DOMActivate" submission="release-submission"/>
>     <xforms:label>Save</xforms:label>
>     <xxforms:script ev:event="DOMActivate">window.close();</xxforms:script>
>   </xforms:trigger>
> ...
>
> When the button is pressed the two XPL services will be called and the popup
> window will be closed. That works fine ... unless there's an error in one of
> the two submissions.
>
> My question:
>
> Is it possible, to stop the trigger from processing send#2 and the script if an
> error occures in send#1? If there's an Exception while saving the file, the
> document should not be released and the window must not be closed.
>  
Yes

You can use events for that :

  <xforms:trigger appearance="button" ref="instance('buttons-instance')//save">
    <xforms:label>Save</xforms:label>
    <xforms:send ev:event="DOMActivate" submission="save-submission"/>
  </xforms:trigger>


   <xforms:submission id="save-submission" ....>
       <xforms:action ev:event="xforms-submit-done">
           <xforms:send ev:event="DOMActivate"
submission="release-submission"/>
        </xforms:action>
       <xforms:action ev:event="xforms-submit-error">
             <xforms:message>Error</xforms:message>
        </xforms:action>
    </xforms:submission>

   <xforms:submission id="release-submission" ....>
       <xforms:action ev:event="xforms-submit-done">
             <xxforms:script>window.close();</xxforms:script>
        </xforms:action>
       <xforms:action ev:event="xforms-submit-error">
             <xforms:message>Error</xforms:message>
        </xforms:action>
    </xforms:submission>

etc...

HTH,

Marc


--
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
Reply | Threaded
Open this post in threaded view
|

Re: Re: Multiple submissions: Stop on error

weyer-2
Thanks a lot, sometimes I tend to overlook the obvious ;-P. It's working
now.

marc schrieb:

> [hidden email] a écrit :
>> Hello again,
>>
>> in one of my forms I want to request multiple XPLs by klicking one
>> trigger.
>> Let's take the folowing simplified example:
>>
>> ...
>>   <!-- save the current data-instance in the existing xml file -->
>>   <xforms:submission id="save-submission"
>> ref="instance('data-instance')"
>> replace="none" method="post" action="/services/savexml"/>
>>   <!-- release the document (set db flag) by calling an ejb method -->
>>   <xforms:submission id="release-submission"
>> ref="instance('meta-instance')"
>> replace="none" method="post" action="/services/release-document"/>
>> ...
>>   <xforms:trigger appearance="button"
>>       ref="instance('buttons-instance')//save">
>>     <xforms:send ev:event="DOMActivate" submission="save-submission"/>
>>     <xforms:send ev:event="DOMActivate"
>> submission="release-submission"/>
>>     <xforms:label>Save</xforms:label>
>>     <xxforms:script
>> ev:event="DOMActivate">window.close();</xxforms:script>
>>   </xforms:trigger>
>> ...
>>
>> When the button is pressed the two XPL services will be called and
>> the popup
>> window will be closed. That works fine ... unless there's an error in
>> one of
>> the two submissions.
>>
>> My question:
>>
>> Is it possible, to stop the trigger from processing send#2 and the
>> script if an
>> error occures in send#1? If there's an Exception while saving the
>> file, the
>> document should not be released and the window must not be closed.
>>  
> Yes
>
> You can use events for that :
>
>  <xforms:trigger appearance="button"
> ref="instance('buttons-instance')//save">
>    <xforms:label>Save</xforms:label>
>    <xforms:send ev:event="DOMActivate" submission="save-submission"/>
>  </xforms:trigger>
>
>
>   <xforms:submission id="save-submission" ....>
>       <xforms:action ev:event="xforms-submit-done">
>           <xforms:send ev:event="DOMActivate"
> submission="release-submission"/>
>        </xforms:action>
>       <xforms:action ev:event="xforms-submit-error">
>             <xforms:message>Error</xforms:message>
>        </xforms:action>
>    </xforms:submission>
>
>   <xforms:submission id="release-submission" ....>
>       <xforms:action ev:event="xforms-submit-done">
>             <xxforms:script>window.close();</xxforms:script>
>        </xforms:action>
>       <xforms:action ev:event="xforms-submit-error">
>             <xforms:message>Error</xforms:message>
>        </xforms:action>
>    </xforms:submission>
>
> etc...
>
> HTH,
>
> Marc


--
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