myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jessica Johnson" <jess...@internetmi.com>
Subject Re: [Trinidad] valueChangeListener called too often?
Date Mon, 03 Dec 2007 19:24:49 GMT
Hi Gerhard,

Thanks for the tip.  Everything works once the bean is changed to
session scope.  Which now that I think about it, it makes sense that
there would be a call to each of the events while using request scope,
since the bean constructor is called each time the form is submitted,
effectively loosing the state of the original bean.

Thanks again!

jessica

On Dec 3, 2007 12:19 PM, Gerhard Petracek <gerhard.petracek@gmail.com> wrote:
> hello jessica,
>
> i presumed that...
> if there is no other problem - the solution is to choose a longer scope.
> just for testing purpose: try to use the session-scope.
>
> if my suggestion is the final solution, i'll explain it in detail.
>
> regards,
> gerhard
>
>
>
> 2007/12/3, Jessica Johnson <jessica@internetmi.com>:
>
> > Hi Gerhard,
> >
> > The bean is request scoped.
> >
> > I removed the autoSubmit in the list boxes, and when I submit the form
> > with a button, I am seeing aChanged and bChanged both being called.
> > I'm not sure if this was the test you were looking for...
> >
> > Let me know if there is other information I can provide.
> >
> > jessica
> >
> > On Nov 30, 2007 7:33 PM, Gerhard Petracek <gerhard.petracek@gmail.com>
> wrote:
> > > hello jessica,
> > >
> > > you are right - more details would be great!
> > >
> > > e.g.:
> > > does the wrong behaviour change without ppr?
> > > (just to avoid that there is a "general" problem... - please change your
> > > page to answer this question - it's just for this test...)
> > > which scope did you choose for the dataReportsLoader-bean?
> > >
> > > regards,
> > > gerhard
> > >
> > >
> > >
> > > 2007/11/30, Jessica Johnson < jessica@internetmi.com >:
> > >
> > > > Hi all,
> > > >
> > > > I'm seeing some strange behavior using PPC and SelectManyListBoxes.  I
> > > > have 3 select boxes: A, B, and C.  When a value in A is selected, the
> > > > values in B and C should change, and the value that is selected should
> > > > also change.  When a value is selected in B the values and selected
> > > > values in C should change.
> > > >
> > > > The problem is that selecting an item in A is firing both of my
> > > > events.  First it fires the event for when A is changed which sets the
> > > > backing bean so that B and C have the desired values and a default
> > > > value is selected in B.  Then it fires the event for when B is
> > > > changed, with the values in the ValueChangeEvent are the values that
> > > > were submitted on the client side.  So the Bchanged event happily
> > > > overwrites the correct selected value that was set in Achanged.
> > > >
> > > > It seems to me that selecting an item in A should trigger *only*
> > > > Achanged and selecting an item in B should trigger *only* Bchanged,
> > > > but selecting an item in either A or B triggers both events.  Is this
> > > > expected behavior?  Have I misunderstood how to set up the triggers?
> > > >
> > > > I have been wracking my brain trying to think of a workaround for this
> > > > (instance variables to prevent double calls, using state, etc.) but
> > > > nothing has panned out so far.
> > > >
> > > > Any ideas would be appreciated.
> > > >
> > > >
> > > > <tr:selectManyListbox id="selectA"
> > > >                       size="4"
> > > >                       binding="#{dataReportsLoader.selectA}"
> > > >                       converter="IntegerConverter"
> > > >                       contentStyle="width: 175px"
> > > >                       autoSubmit="true"
> > > >                       rendered="#{dataReportsLoader.renderFilters}"
> > > >                       valueChangeListener="#{
> dataReportsLoader.aChanged }"
> > > >                       valuePassThru="true"
> > > >                       value="#{dataReportsLoader.selectedAList}" >
> > > >     <f:selectItem itemLabel="-- All As --"
> > > > itemValue="#{dataReportsLoader.allValue}" />
> > > >     <f:selectItems value="#{dataReportsLoader.visibleAList}" />
> > > > </tr:selectManyListbox>
> > > >
> > > > <tr:selectManyListbox id="selectB"
> > > >                       size="4"
> > > >                       binding="#{dataReportsLoader.selectB}"
> > > >                       contentStyle="width: 175px"
> > > >                       converter="IntegerConverter"
> > > >                       autoSubmit="true"
> > > >
> valueChangeListener="#{dataReportsLoader.bChanged }"
> > > >                       valuePassThru="true"
> > > >                       value="#{ dataReportsLoader.selectedBList}"
> > > >                       partialTriggers="selectA"
> > > >                       rendered="#{dataReportsLoader.renderFilters}" >
> > > >     <f:selectItem itemLabel="-- All Ad Groups --"
> > > > itemValue="#{dataReportsLoader.allValue }" />
> > > >     <f:selectItems value="#{dataReportsLoader.visibleBList}" />
> > > >
> > > > </tr:selectManyListbox>
> > > >
> > > > <tr:selectManyListbox id="selectC"
> > > >                       size="4"
> > > >                       binding="#{dataReportsLoader.selectC}"
> > > >                       converter="IntegerConverter"
> > > >                       contentStyle="width: 175px"
> > > >                       valuePassThru="true"
> > > >                       value="#{dataReportsLoader.selectedCList}"
> > > >                       partialTriggers="selectB"
> > > >                       rendered="#{ dataReportsLoader.renderFilters}" >
> > > >     <f:selectItem itemLabel="-- All Cs --"
> > > > itemValue="#{dataReportsLoader.allValue }" />
> > > >     <f:selectItems value="#{dataReportsLoader.visibleCList }" />
> > > > </tr:selectManyListbox>
> > > >
> > > >
> > > >
> > > >
> > > > aChanged() changes the values for visibleBList, visibleCList,
> > > > selectedAList based on the ValueChangedEvent's newValue
> > > > bChanged() changes the values for visibleCList and selectedCList based
> > > > on the values of ValueChangedEvent's newValue
> > > >
> > > >
> > > > I can post the code if anyone is interested.
> > > >
> > > > Thanks,
> > > >
> > > > jessica
> > > >
> > >
> > >
> > >
> > > --
> > >
> > >   http://www.irian.at
> > >
> > > Your JSF powerhouse -
> > > JSF Consulting, Development and
> > > Courses in English and German
> > >
> > > Professional Support for Apache MyFaces
> >
>
>
>
> --
>
>
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces

Mime
View raw message