> i have tried both of these approaches but neither cancel the event on the
> <a>... if yours works what is the fundamental difference?

when you click on the text only one click event is created and it
bubbles up through the dom.  So it first is triggered on the span and
then bubbles up to the a and so on. You need to actually cancel the
event if you want it to stop bubbling. In prototype you can use the
Event.stop() function.

<a href="#" id="link"><span id="linkSpan">Observed</span></a>
<script>
$('link').observe("click", function(e) {alert("You clicked a link!");});
$('linkSpan').observe("click", function(e) { if ( confirm('stop span
click event?') ) { Event.stop(e); return false; }});
</script>

Hope that helps!

Josh

On Tue, Jul 13, 2010 at 5:04 AM, Paul Stanton <p...@mapshed.com.au> wrote:
> thanks geoff,
>
> your last post where you put the confirm mixin on a <span> within the <a> is
> interesting .. wouldn't that be rendered as the equivalent of:
>
> <a ....><span onclick="return confirm('?');">text</span></a>
>
> or at least the prototypesque version of this:
>
> <a ....><span id="spanId">text</span></a>
> Event.observe($("spanId"), 'click', function(e){if (!confirm('?'))
> e.stop();});
>
> i have tried both of these approaches but neither cancel the event on the
> <a>... if yours works what is the fundamental difference?
>
> regards, p.
>
> Geoff Callender wrote:
>>
>>
>> http://tapestry-users.832.n2.nabble.com/Confirm-mixin-won-t-cancel-when-in-zone-td5048950.html#a5048950
>>
>> On 13/07/2010, at 12:31 PM, Paul Stanton wrote:
>>
>>
>>>
>>> Hi all,
>>>
>>> I was hoping to be able to use a simple js confirm in order to
>>> (conditionally) cancel the callback from an async event link:
>>>
>>> <a t:type="eventLink" event="DeleteRecord" context="record.id"
>>> zone="myZone" onclick="return confirm('sure?');">delete</a>
>>>
>>> Unfortunately, even when 'Cancel' is clicked, the callback is executed.
>>>
>>> What is the simplest way to add one stage of logic to this process?
>>>
>>> Thanks, Paul.
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

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

Reply via email to