W3C home > Mailing lists > Public > www-forms@w3.org > April 2007

Using the same handler to observe multiple different events

From: Clark, John <CLARKJ2@ccf.org>
Date: Thu, 5 Apr 2007 16:07:38 -0400
Message-ID: <F122C25B4CD6F34BB119A97593679601027CA854@CCHSCLEXMB59.cc.ad.cchs.net>
To: www-forms@w3.org

I am interested in reusing event handlers, and I was wondering if the combination of Xforms (1.1) and XML Events allows this.  For example, say I have an event handler (an `xf:action` element) that looks like this:

  <xf:action ev:event="some-event" ev:observer="observer1"
             id="handler">
    <!-- Potentially complex handler logic here -->
  </xf:action>

If I want the same handler logic to also respond to a second event (and potentially at a different observer location), I would like to not have to take the na´ve approach and duplicate the entire action.  The XML Events specification gives us one tool, the `ev:listener` element.  "Reregistering" the above handler might look like:

  <ev:listener event="some-other-event" observer="observer2"
               handler="#handler"/>

Is the `ev:listener` element allowed in XForms, however?  Also, how would the use of the relative reference in `handler="#handler"` interact with IDREF resolution in XForms[0]?  If the `ev:listener` element is not allowed in XForms, then another possibility is to use the `ev:handler` attribute, which might look like this:

  <xf:action ev:event="some-other-event" ev:observer="observer2"
             ev:handler="#handler"/>

The same question about IDREF resolution applies here, though.  Also, the spec says that the `action` element "causes its child actions to be invoked in the order that they are specified in the document"[1]; does that allow for pointing at a different handler?

[0] http://www.w3.org/TR/2007/WD-xforms11-20070222/#idref-resolve

[1] http://www.w3.org/TR/2007/WD-xforms11-20070222/#action-action

Thanks, and take care,

    John L. Clark  |  Systems Analyst
                   |  Cardio-Thoracic Surgery Research
 Cleveland Clinic  |  9500 Euclid Ave.   |  Cleveland, OH 44195
                   |  (216) 445-6011





Cleveland Clinic is ranked one of the top 3 hospitals in
America by U.S.News & World Report. Visit us online at
http://www.clevelandclinic.org for a complete listing of
our services, staff and locations.


Confidentiality Note:  This message is intended for use
only by the individual or entity to which it is addressed
and may contain information that is privileged,
confidential, and exempt from disclosure under applicable
law.  If the reader of this message is not the intended
recipient or the employee or agent responsible for
delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If
you have received this communication in error,  please
contact the sender immediately and destroy the material in
its entirety, whether electronic or hard copy.  Thank you.


===================================
Received on Thursday, 5 April 2007 20:07:23 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:09 GMT