W3C home > Mailing lists > Public > www-forms@w3.org > September 2005

RE: Cancelling events

From: Mark Birbeck <mark.birbeck@x-port.net>
Date: Fri, 2 Sep 2005 17:26:08 +0100
Message-ID: <C75A01B6-3C1F-4025-994A-82546EF86E36@S009>
To: "'Ben Cochran'" <BCochran@ClubMom-inc.com>
Cc: <www-forms@w3.org>
Hi Ben,
You can't cancel events conditionally, if that's what you mean. I have
proposed some extra XPath functions that would allow you to do this, but
they are still under discussion on the XForms Working Group.

Mark Birbeck
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
w: http://www.formsPlayer.com/
b: http://internet-apps.blogspot.com/

Download our XForms processor from



From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On Behalf
Of Ben Cochran
Sent: 30 August 2005 19:01
To: www-forms@w3.org
Subject: Cancelling events

What I'm looking for is a good solid example of how to cancel an event in

Specific case: I have a pair of models, one being submitted to an XML file
via 'put', the other going to a servlet via 'url-encoded-post'.  Both of
these models are being submitted "simultaneously," through two <send>
actions tied to a single <trigger>.

Now, rather than have logic in the servlet so as not to perform a DB update
if one of the values is empty, I'd rather just not send that submission at
all.  Particularly, what I'd like to do (I think) is cancel the
xforms-submit event before it hits the servlet-tied submission.  What I
can't figure out is how to do this.  As tests, I've tried adding
ev:defaultAction="cancel" and ev:propogate="stop" to the <send> actions;
adding ev:event="xforms-submit",  ev:propagate="stop", and
ev:defaultAction="cancel" to the servlet's <model> element.  I may well be
on the completely wrong track.  There seems to be precious little online or
in Xforms books that gives anything else other than listing the event-model
attributes and saying "you can cancel events."

Any help is appreciated. 

----Example Code Below---- 

<?xml version="1.0" encoding="UTF-8"?> 
                <title>Multiple Submission Test</title> 
                <xf:model id="servlet_model"> 
                        <xf:instance id="servlet_instance" xmlns=""> 
                        <xf:submission id="servlet_submit"
action="TestServlet" method="url-encoded-post" separator="&amp;"

                <xf:model id="xml_model"> 
                        <xf:instance id="xml_instance" xmlns=""> 
                                                <bar someattribute=""> 
                        <xf:submission id="xml_submit"
action="file:///C:/somexml.xml" method="put" replace="none"/> 
                <xf:group model="servlet_model"
ref="instance('servlet_instance')" appearance="full"> 
                        <xf:label>To Servlet</xf:label> 
                        <xf:input ref="value1" appearance="full"> 
                                <xf:label>Value 1 </xf:label> 
                        <xf:input ref="value2"> 
                                <xf:label>Value 2 </xf:label> 
                <xf:group model="xml_model"
ref="instance('xml_instance')/foo" appearance="full"> 
                        <xf:label>To XML</xf:label> 
                        <xf:input ref="value1"> 
                                <xf:label>Value 1</xf:label> 
                        <xf:input ref="bar/@someattribute"> 
                                <xf:label>Some Attribute</xf:label> 
                        <xf:input ref="bar/value2"> 
                                <xf:label>Value 2</xf:label> 
                <xf:group appearance="minimal"> 
                                <xf:label>Submit Both</xf:label> 
                                <xf:action ev:event="DOMActivate"> 
                                        <xf:send submission="xml_submit"/> 
resource="http://www.yahoo.com" show="replace"/> 

CMI Marketing, Inc.
Ben Cochran 
Technical Lead, Interface Engineering 
401 Park Avenue South
5th Floor
New York, New York 10016
tel 646.435.6508
fax 646.435.6600
Received on Friday, 2 September 2005 16:26:50 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:15 UTC