I see what you mean. The "Tapestry.waitForPage(event)" is not a problem. The real problem is that Tapestry.init (which is added to the bottom of the page after "new Confirm(...)") sets up the linkZone, part of which is adding "element.observe("click", function(event) { some XHR stuff happens here })". That's all in tapestry.js.
So ideally Confirm.doConfirm would remove or add Tapestry's linkZone click observer depending on whether you confirm or cancel the dialog box. BUT, how do I get a list of event observers in this version of prototype (1.6.0)? Geoff On 14/05/2010, at 4:59 PM, Josh Canfield wrote: > event.stop() prevents bubbling up to parent elements, but I don't > believe you can prevent other event handlers from firing (you can test > to see if the event.stopped property is set but it's up to the other > events to implement the check). > > That said, the linkZone method sets the onclick function on the object > directly instead of using Event.observe. I haven't looked at it hard > enough to pass judgement but this gives you the opportunity to chain > the onclick handler by saving a copy in your object and replacing it > with your own function. Since you can't enforce ordering for observed > events, or prevent them from running maybe this is why onclick is set > directly. > > Josh > > > On Thu, May 13, 2010 at 5:22 PM, Geoff Callender > <geoff.callender.jumpst...@gmail.com> wrote: >> I have a Confirm mixin that works fine until I put it in a zone. It still >> pops up a confirmation dialog but when Cancel is pressed the mixin fails to >> stop the event. >> >> My mixin adds javascript that observes the element, but the zone seems to >> upset it by adding javascript directly to the element, eg: >> >> <a id="eventlink" onclick="javascript:Tapestry.waitForPage(event);" >> shape="rect" href="./simplewithzone:delete">Delete...</a> >> >> What do I need to change in Confirm to make it stop the event when there's a >> zone? >> >> Here's source for confirm.js and Confirm.java: >> >> var Confirm = Class.create(); >> Confirm.prototype = { >> >> initialize: function(elementId, message) { >> this.message = message; >> Event.observe($(elementId), 'click', >> this.doConfirm.bindAsEventListener(this)); >> }, >> >> doConfirm: function(e) { >> if (! confirm(this.message)) { >> e.stop(); >> } >> } >> >> } >> >> package jumpstart.web.mixins; >> >> import org.apache.tapestry5.BindingConstants; >> import org.apache.tapestry5.ClientElement; >> import org.apache.tapestry5.RenderSupport; >> import org.apache.tapestry5.annotations.AfterRender; >> import org.apache.tapestry5.annotations.IncludeJavaScriptLibrary; >> import org.apache.tapestry5.annotations.InjectContainer; >> import org.apache.tapestry5.annotations.Parameter; >> import org.apache.tapestry5.ioc.annotations.Inject; >> >> @IncludeJavaScriptLibrary("confirm.js") >> public class Confirm { >> >> @Parameter(value = "Are you sure?", defaultPrefix = >> BindingConstants.LITERAL) >> private String message; >> >> @Inject >> private RenderSupport renderSupport; >> >> @InjectContainer >> private ClientElement element; >> >> @AfterRender >> public void afterRender() { >> renderSupport.addScript(String.format("new >> Confirm('%s', '%s');", element.getClientId(), message)); >> } >> >> } >> >> Thanks in advance, >> >> Geoff > > > > -- > -- > 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 >