RE: Problem with actions order in <xf:action>

Hi Sergey,

Sorry, but that's a difference in interpretation of the spec, but a bug in
formsPlayer.

There is a problem with actions when they are inside a xf:repeat; the
elements are parsed by IE in reverse order, which means we receive them in
reverse order, store them in reverse order, and then execute them in reverse
order!

Everything is OK if you take the list of actions outside the xf:repeat. As
it happens, if the events are to be triggered by some UI interaction then
you don't gain anything by having the handlers inside the xf:repeat; each
set of handlers will be repeated for each row, but since focus will be given
to the 'current row' when the user activates a trigger, then only the
'current row' will ever generate events. In that case you may as well just
put an observer *outside* the xf:repeat, since it always 'observes' the
'current row'. (This does not apply if the event you are interested in is
something like xforms-value-changed, which will be different for each row.)

Also, putting the handlers outside of the xf:repeat will reduce the size of
the handler that gets repeated, since all you need to do in that is dispatch
a single event:

  <xf:repeat nodeset="/root/object">
    <!-- we may have 20 of these ... -->
    <xf:trigger>
      <xf:label>Do</xf:label>
      <xf:action ev:event="DOMActivate">
        <xf:dispatch target="my-events" name="my-notify" />
      </xf:action>
    </xf:trigger>
  </xf:repeat>

  <!-- ... But we only need 1 of these -->
  <xf:group id="my-events">
    <xf:action ev:event="my-notify">
      <xf:message level="modal">1</xf:message>
      <xf:message level="modal">2</xf:message>
    </xf:action>
  </xf:group>

We should have a fix in fP for this soon.

Regards,

Mark


Mark Birbeck
CEO
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
http://www.formsPlayer.com/ 

> -----Original Message-----
> From: www-forms-request@w3.org 
> [mailto:www-forms-request@w3.org] On Behalf Of Sergey Shebanin
> Sent: 21 July 2005 15:38
> To: www-forms@w3.org
> Subject: Problem with actions order in <xf:action>
> 
> 
> Hello.
> 
> I try to use <xf:action> tag in this situation:
> 
> Model:
>     <xf:model>
>       <xf:instance>
>           <root xmlns="">
>               <object/>
>               <object/>
>           </root>
>       </xf:instance>
>     </xf:model>
> 
> Body:
>       <xf:trigger>
>           <xf:label>Do</xf:label>
>           <xf:action ev:event="DOMActivate">
>                <xf:message level="modal">1</xf:message>
>                <xf:message level="modal">2</xf:message>
>           </xf:action>
>       </xf:trigger>
>       <xf:repeat nodeset="/root/object">
>           <xf:trigger>
>               <xf:label>Do</xf:label>
>               <xf:action ev:event="DOMActivate">
>                    <xf:message level="modal">1</xf:message>
>                    <xf:message level="modal">2</xf:message>
>               </xf:action>
>           </xf:trigger>
>       </xf:repeat>
> 
> It will display 3 buttons with text 'Do'.
> --FormsPlayer 1.3.4.1010--
> When I click on first button I see message box with text '1' 
> and then message box with text '2'.
> When I click on second or third button I see message box with 
> text '2' 
> and then message box with text '1'.
> --Mozilla Deer Park Alpha 2 and XForms 0.2-- When I click on 
> any button I see message box with text '1' and then message 
> box with text '2'.
> 
> Why this difference? How it must be in order with W3C Recommendation?
> 
> Thanx.
> 
> 

Received on Thursday, 21 July 2005 20:24:16 UTC