This has been discussed a few times. The right way would be to use
event propagation as intended, for example:
<t:removerowlink><span id="confirmRemoval">Remove</span></t:removerowlink>

Then add a handler for the nested element:
Event.observe($('confirmRemoval'), 'click', function(event) {if
(!confirm('are you sure to want to remove?')) event.stop();});
to stop the event from being propagated to the actionlink handler.

Since you are dealing with rows, the problem is with gathering all the
ids of nested elements. If you used a button inside the link instead,
you could just use its onclick handler:
<t:removerowlink><button onclick="javascript:return confirm('blab
la?')">Remove</button></t:removerowlink>

Kalle


On Thu, Jun 30, 2011 at 10:18 AM, Ernesto Badillo <ernest...@gmail.com> wrote:
> Hi,
>
> I was trying to add a small script asking for confirmation before
> removing an element contained in the ajaxformloop component. The first
> thing I tried was the following:
>
> <t:removerowlink onclick="javascript:return confirm('blab
> la?')">Remove</t:removerowlink>
>
> This doesn't work becasue this component's onclick handler is called
> first and thus it is not possible to stop the removal. Then I
> considered using a mixing like this:
>
> http://www.nuiton.org/repositories/entry/nuiton-web/trunk/nuiton-tapestry/src/main/java/org/nuiton/web/tapestry5/mixins/Confirm.java
>
> However, the problem here is that the removerowlink component doesn't
> implement ClientElement so it is not possible to retrieve its id to
> add an onclick handler.
>
> The only option left seems to be creating my own removerowlink
> component. ¿Is there any other thing I can do? ¿Is it possible to do
> this with a mixin?
>
> Thanks!
>
> --
> Ernesto Badillo
>
> "Always code as if the person who will maintain your code is a maniac
> serial killer that knows where you live."
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to