You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian Dutaret <cd...@gmail.com> on 2006/09/27 15:29:13 UTC

EventListener called several times

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.

Re: EventListener called several times

Posted by Jesse Kuhnert <jk...@gmail.com>.
Awesome thanks, I'll look at it during the next triage. (Which should be
soon now since the date i18n issues seem to be fixed. )

FYI - you don't even need a jetty configuration file to configure it with
maven. It's literally like 2-3 lines of configuration in the pom.xml file.

On 9/28/06, Christian Dutaret <cd...@gmail.com> wrote:
>
> https://issues.apache.org/jira/browse/TAPESTRY-1100
>
> I tried to post this the "mark reynold's way", with a maven2 sample
> application attached, except that I don't use Jetty (I use Tomcat), so no
> Jetty configuration.
> Hope this helps
> Ch.
>
> 2006/9/27, Jesse Kuhnert <jk...@gmail.com>:
> >
> > Hmmm....Can you still post a bug in JIRA anyways? This sounds like a
> > possible bug in one the services. (be as detailed as possible about what
> > you
> > did to have it happen, if that's possible..)
> >
> > On 9/27/06, Christian Dutaret <cd...@gmail.com> wrote:
> > >
> > > 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 <cd...@gmail.com>:
> > > >
> > > > 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.
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> > Jesse Kuhnert
> > Tapestry/Dojo/(and a dash of TestNG), team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> >
> >
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo/(and a dash of TestNG), team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

Re: EventListener called several times

Posted by Christian Dutaret <cd...@gmail.com>.
https://issues.apache.org/jira/browse/TAPESTRY-1100

I tried to post this the "mark reynold's way", with a maven2 sample
application attached, except that I don't use Jetty (I use Tomcat), so no
Jetty configuration.
Hope this helps
Ch.

2006/9/27, Jesse Kuhnert <jk...@gmail.com>:
>
> Hmmm....Can you still post a bug in JIRA anyways? This sounds like a
> possible bug in one the services. (be as detailed as possible about what
> you
> did to have it happen, if that's possible..)
>
> On 9/27/06, Christian Dutaret <cd...@gmail.com> wrote:
> >
> > 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 <cd...@gmail.com>:
> > >
> > > 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.
> > >
> > >
> >
> >
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo/(and a dash of TestNG), team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>
>

Re: EventListener called several times

Posted by Jesse Kuhnert <jk...@gmail.com>.
Hmmm....Can you still post a bug in JIRA anyways? This sounds like a
possible bug in one the services. (be as detailed as possible about what you
did to have it happen, if that's possible..)

On 9/27/06, Christian Dutaret <cd...@gmail.com> wrote:
>
> 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 <cd...@gmail.com>:
> >
> > 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.
> >
> >
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo/(and a dash of TestNG), team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

Re: EventListener called several times

Posted by Christian Dutaret <cd...@gmail.com>.
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 <cd...@gmail.com>:
>
> 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.
>
>