I was running my application with caching disabled on my dev environment. If I enable caching, then guess what... it works as expected (events are sent only once when A changes). Amazing. After a closer look, it seems that the updated event registration script is sent with a different id (formEventnnnnnnnnn) when caching is disabled, thus not cleaning previously registered events. I'm really happy to have this sorted, since this looked as a show stopper for a production application. It is still a bit annoying on dev environments, but I can live with this (until jesse releases a fix ;-) Thanks for the nice work again anyway
2006/9/27, Christian Dutaret <[EMAIL PROTECTED]>:
Hi all, I am observing a very strange behavior with EventListener. On a first example, I have a PropertySelection component that updates an Insert component under onchange event using @EventListener annotation. Works fine. Now I have the same PropertySelection component (A), now updating another PropertySelection (B) object within the same form (instead of the Insert component). When A changes, I can see from the dojo console that in addition to the content of B (which is correctly updated), the javascript code that registers the onchange event is also executed again (this didn't happen on the example with the Insert component). As a result, it seems that the event is registered twice: when A changes again, my listener is called twice, then four times on the following change, etc Does that make any sense to you guys? extracted from the dojo console when component A changes: DEBUG: 14:47:20: Response recieved. DEBUG: 14:47:20: Received element content for id <formhidden> of: <input type="hidden" name="formids" value="a,sb,c,Submit"/> <input type="hidden" name="component" value="form"/> <input type="hidden" name="page" value="Home"/> <input type="hidden" name="service" value="direct"/> <input type="hidden" name="submitmode" value=""/> <input type="hidden" name="submitname" value=""/> DEBUG: 14:47:20: Received element content for id <sb> of: <option value="0" selected="selected">Choose...</option> <option value="3">B3</option> <option value="4">B4</option> DEBUG: 14:47:21: evaluating script: //<![CDATA[ dojo.require("dojo.event"); dojo.require("tapestry.*"); //]]> DEBUG: 14:47:21: evaluating script: //<![CDATA[ tapestry.cleanConnect( dojo.byId("a"), "onchange", "formEvent1723431748"); tapestry.formEvent1723431748=function(e){ var content={beventname:"onchange"}; tapestry.event.buildEventProperties(e, content); if (!content["beventtarget.id"]) content["beventtarget.id"]="a"; var validateState=tapestry.form.forms["form"].validateForm; var validateForm=false; tapestry.form.setFormValidating("form", validateForm); tapestry.form.submitAsync("form", content); tapestry.form.setFormValidating("form", validateState); }; dojo.event.connect(dojo.byId("a"), "onchange", tapestry, "formEvent1723431748"); //]]> Thanks for any help Ch.