I found a nice solution using dojo's ability to listen to an arbitrary
javascript function as if it were a native event.
I attach an empty js function to an arbitrary DOM element like this:

document.getElementById('someDiv').clickRadio=function(radio) {};

and an onclick attribute to my radio buttons:

<span jwcid="@Radio" value="ognl:lv.value" onclick="document.getElementById
('someDiv').clickRadio(this);"/>

Then I can set an EventListener on the server-side

   @EventListener(targets = "someDiv", events = "clickRadio", submitForm =
"form")
   public void listenToOnclickOnAnyRadioButtonInTheForLoop(IRequestCycle
cycle) throws InterruptedException {
       ...
   }

Works fine.
Ch.


2006/10/3, Dennis Sinelnikov <[EMAIL PROTECTED]>:

I'm glad someone else has a need for this as well.  From doing a little
bit of research the other day, I found @EventListener annotation that
was introduced into tapestry 4.1+ that "sort of" fixes the problem. I'm
currently using stable release of tapestry 4.0.2, so I didn't bother
going that route. I believe this can be accomplished with tacos, but not
sure.  If you find something I would love to see an example, I'll do the
same as well...

Good Luck,
Dennis

Christian Dutaret wrote:
> Hi,
>
> Is it possible to have an EventListener for events on components within
a
> @For loop? Typically, I have a set of radio buttons, which are rendered
> from
> @Radio components within a @For loop (with a surrounding @RadioGroup
> component), and I want to invoke a listener whenever an onclick event
> occurs
> on any of those radio buttons.
> I could achieve this with @contrib:XTile components, but I'd rather use
the
> same programming model everywhere. It would be nice, for instance, to
> set an
> EvenListener on the @RadioGroup component, and have it propagate the
event
> on nested @Radio components.
>
> Thx
> Ch.
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to