Hey All,
I'm a bit puzzled as to how to send events to repeated controls. In the reproducible example attached, I have the main XHTML document which contains an 'idinfo' XBL component and a "Dispatch Event" trigger. When the "Dispatch Event" trigger is clicked, 'event1' is dispatched to the XBL component. 'Event2' is then dispatched by the <xbl:handler> element once 'event1' is observed. However, the observer for 'event2' is a trigger within a repeat, and I'd like to be able to have the event take place for ALL repeated triggers. At the moment, it seems to just take place with one of them (hence only one 'idinfo' element is being inserted within the 'test' instance). What am I doing wrong here? I am contemplating wrapping an <xforms:dispatch> event around an <xforms:action> statement with the xxforms:iterate attribute, but I wanted to make sure this was possible, especially with nested elements. Thanks in advance for any help or suggestions! :-) ---Philip xforms-xbl-test2.zip |
Administrator
|
Philip,
The issue is that you need to dispatch an event to each repeat iteration. One way is to setindex to all the iterations and then dispatch, like this: <xbl:handler event="event1" phase="target"> <xxforms:variable name="initial-index" select="index('idinfo-repeat')"/> <xf:action xxforms:iterate="idinfo"> <xf:setindex repeat="idinfo-repeat" index="position()"/> <xf:dispatch name="event2" targetid="event-trigger"/> </xf:action> <xf:setindex repeat="idinfo-repeat" index="$initial-index"/> </xbl:handler> -Erik
|
Administrator
|
And here is a simple example showing this without XBL:
http://pastie.org/597379 -Erik
|
In reply to this post by Erik Bruchez
Erik,
Thanks for the direction and the example! It works like a charm! ---Philip
|
Free forum by Nabble | Edit this page |