W3C home > Mailing lists > Public > www-forms@w3.org > July 2006

Re: Event questions.

From: Aaron Reed <aaronr@us.ibm.com>
Date: Fri, 28 Jul 2006 11:56:05 -0500
To: www-forms@w3.org
Message-ID: <eadfje$ier$1@sea.gmane.org>

Hi Roger,

My replies below.

Rogelio Pérez Cano wrote:
> Hi All,
> I have three questions related to Events in XForms.
> 1- The latest XForms 1.0 recommendation doesn´t forbid a handler attribute
> in an <action> element,so does it mean that an <action> can be defined with
> a handler attribute pointing to another <action>? 
> (This can be usefull in order to reuse code).
>   Something like that should it work? 
> ....
> <xforms:trigger id="trigger1"> 
>   <xforms:label>Button1</xforms:label> 
>   <xforms:action ev:event="DOMActivate" ev:target="trigger1"
> ev:observer="trigger1" ev:handler="action2"/>
> </xforms:trigger>
> <xforms:trigger>
>   <xforms:label>Button2</xforms:label> 
>   <xforms:message id="action2" level="modal" ev:event="DOMActivate"> Hi
> again!!</xforms:message>
> </xforms:trigger>
> ......
> I mean, when the "Button1" is pressed should the message be shown?

In this particular scenario the message won't show because you have an 
error in your form.  You should have ev:handler="#action2" since the 
attribute value for ev:handler is a URI, not an id.  But yes, according 
to the XML Event spec this should be able to work and indeed it does 
work in Mozilla XForms.  The only issue you might have in reusability is 
the context for any xpath evaluations that might need to happen inside 
the xf:action.  The context will still be where the action lives, it 
won't be relative to the listener that causes the action handler to fire.

> 2- What is the interpretation of an <action> in terms of XML Events, is it a
> listener or can be always considered like a handler?

The way I look at it, the 'listener' is the element with the ev:handler 
attribute on it.  The 'handler' is either specified as the value of the 
ev:handler attribute or if the ev:event attribute is on an element and 
ev:handler is not, then that element that contains the ev:event is the 
handler.  So in your above scenario, the xf:action is the listener and 
the xf:message is the handler.

> 3- What is the aim of having events in a <model> element, more specifically
> what does this sentence mean?
> "Attributes from XML Events are allowed on this element to facilitate
> creating observers"

You could have <xf:model ev:event="xforms-ready" 
ev:handler="#popupReadyMessage"> so that when the model gets the 
xforms-ready event, it will trigger the popupReadyMessage handler.

> Many thanks
> Roger.

I hope that this helps,
Received on Friday, 28 July 2006 16:58:45 UTC

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