- From: Erik Bruchez <ebruchez@orbeon.com>
- Date: Tue, 17 Apr 2007 16:42:27 +0800
- To: www-forms@w3.org
All, ev:listener is good and yes, XForms implementations are supposed to support it, but my opinion is that it is heavy for this particular use case. I was suggesting back a while ago that XML Events should support lists of space-separated event names. You would then write: <xf:action ev:event="some-event some-other-event"> This would be a much more concise syntax, and it is easy to understand. -Erik Aaron Reed wrote: > > Hi John, > > Using ev:listener is how I would reuse handlers. No reason that an > ev:listener can't work in XForms. > > To clarify actions if you had: > > <xf:trigger> > <xf:label>handle some-other-event</xf:label> > <xf:action id="handler2" ev:event="DOMActivate" > ev:observer="observer2" ev:handler="#handler"> > <xf:message level="modal">DOMActivate happened</xf:message> > </xf:action> > </xf:trigger> > > and you have another action with id="handler", then when the trigger is > clicked, the above action would not process its contents (and thus the > above message would not be shown) since it is actually only specifying > what the actual handler would be, not acting as a handler itself. But > whatever actions appear in xf:action with @id="handler" would be processed. > > I hope that this helps, > --Aaron > > Clark, John wrote: >> 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. >> >> >> =================================== >> >> > > > -- Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/
Received on Tuesday, 17 April 2007 08:42:46 UTC