> // Late, to overwrite other event handlers > javascriptSupport.addInitializerCall(InitializationPriority.LATE, > "yourModalBoxBuilder", spec);
Getting a late initialization is critical but not the solution. Howard's solution is to remove all the click handlers from the link and replace them with a new one. /* * Replace the normal click event, knowing that in most cases, the * original link or button has an Tapestry.ACTION_EVENT event handler to * do its real work. */ element.stopObserving("click"); Look towards the bottom of this file: https://github.com/hlship/tapx/blob/master/tapx-core/src/main/resources/com/howardlewisship/tapx/core/tapx.js I have an irrational fear of removing all click handlers from a link. I know it's irrational and yet the fear persists... Nicolás should definitely have a look at tapx for inspiration :) Josh On Thu, Jun 16, 2011 at 10:55 AM, Guerin Laurent <lgue...@sopragroup.com> wrote: > Perhaps, i have missing something, but i think you can, by setting the > parameter InitializationPriority.LATE on your Javascript initialisation call : > > // Late, to overwrite other event handlers > javascriptSupport.addInitializerCall(InitializationPriority.LATE, > "yourModalBoxBuilder", spec); > > In this way, your handle has the priority and you'll be able stop the initial > event fired by the actionlink (even if there is an ajax zone). > > This is what is done by the Confirm modalBox mixin written by Howard into > tapx project : > https://github.com/hlship/tapx/blob/master/tapx-core/src/main/java/com/howardlewisship/tapx/core/mixins/Confirm.java > > My 2 cents :-) > > Laurent > ________________________________________ > De : Josh Canfield [joshcanfi...@gmail.com] > Date d'envoi : jeudi 16 juin 2011 18:48 > À : Tapestry users > Objet : Re: Mixin competes with Zone's event handler > >> is there any way to manage to execute the Tapestry.ZoneManager's event >> handler only after user clicks Yes button on my mixin's Yes button? > > No, I don't believe you can. As I recall it binds to click on the <a> > and events are executed in an undefined order. > > The following link from the list describes doing exactly what you're > looking for. > > http://tapestry-users.832.n2.nabble.com/quot-Confirm-quot-mixin-won-t-cancel-when-in-zone-td5048950.html#a5048950 > > Josh > > On Thu, Jun 16, 2011 at 8:42 AM, Nicolas Barrera <nbarr...@gmail.com> wrote: >> Hi T5 users! >> >> I got the following problem (I dsthink my mixin is competing with the Zone's >> javascript code when the actionLink I apply my mixing has also a t:zone), >> >> i 'm developing a confirmation dialog box Mixin... (using some cool modal >> window plugin) >> >> that is.., i got an ActionLink with t:mixin="confirmBox" attribute so when i >> click on it a dialog box appears with two buttons (Yes/No) if I click No the >> dialog box dissapears and >> the page remain the same (I 'm using prototype's Event.stop(e) here) >> >> If I click Yes, then the dialog box dissapears and the page should do what >> clicking in an ordinary eventLink would do. >> >> >> The problem arises when I apply my mixin to an actionLink which also has a >> zone associated to it, in this case the dialog box appears but rapidly >> dissapears and the zone is refreshed, first it seemed that >> the Event.stop(e) wasn't working but then, >> >> I realized that the actionLink had two listeners to the action link's >> onclick event: >> >> * My event handler >> * And the Tapestry.ZoneManager event handler where he does the ajax request >> and refreshes the zone >> >> >> is there any way to manage to execute the Tapestry.ZoneManager's event >> handler only after user clicks Yes button on my mixin's Yes button? >> >> cheers and thanks in advance! >> >> Nicolás.- >> > > --------------------------------------------------------------------- > 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 > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org