Hi Torsten,

You mention that the last rendered component is the value that is used.
Would a hidden component at the end of the form, which is set to the
changed value work for you?

Failing this you could use JavaScript to make sure that both selectOne
values are changed when one changes.

HTH,

Fintan 

-----Original Message-----
From: Torsten Krah [mailto:[EMAIL PROTECTED] 
Sent: 05 July 2006 16:08
To: MyFaces Discussion
Subject: components and valuechange events - "forgotten" update of
othercomponents watching the same backing bean attribute - Updates lost
onbacking bean when the last rendered component isn't used


Hello.

I've got 2 components, watching one backing bean value:

                        <h:selectOneMenu value="#{tableData.country}"
onchange="submit()" immediate="true"
        
valueChangeListener="#{tableData.countryChanged}">
                                <f:selectItems
value="#{tableData.countryNames}" />
                        </h:selectOneMenu>
                        <h:selectOneMenu value="#{tableData.country}"
onchange="submit()" immediate="true">
                                <f:valueChangeListener
type="my.examples.CountryListener"/>
                                <f:selectItems
value="#{tableData.countryNames}" />
                        </h:selectOneMenu>      

If i change the value of the one component, the other dont get it - of
cause, because the new value is in the event object and these are
processed later, the other component saw the old value, which is changed
after that - so the component missed the update.

Doing a second submit of another kind, shows the correct active value
for the attribute watched, now correct on the former wrong displayed
component. How to solve this problem, that a value may be watched by
different components ( doesnt matter if the components use the same
listener or not  ). ?

Lets call the above problem X.

Now it also happens, that if another valuechangeevent for another
component is thrown and the View gets updated, X shows the wrong active
value, the one of the X component which didnt get updated right.

example:

Y: 10
X1: en
X2: en

click on X1: change it to -> de

update view shows:

Y: 10
X1: de
X2: en

The UI is now rendered with german messages from the de_DE message
bundle.

now click on Y and change it to 5:

updated view shows:

Y: 5
X1: en
X2: en

But the UI is still in german text, not english  - the value of the
backing bean is en, making some updates on Y from 10 to 5 or 20 shows en
in the backing bean, but somewhere the UI forgot to change the locale
back.

Testing a little bit, it seems that the last rendered component watching
this value is the one which counts, regardless if other components
rendered before does some changes to the value of the backing bean, the
value of the last one overrides - although the first ones do update the
view to the correct languages, the event gets called. If i only use the
last rendered component watching the value, backing bean value gets
updated right every time - although the other ones still lack the
problem mentioned X above.

Hope its not to confusing ;).

Bug or not, any solution  for the tow problems or am i doing a fatal
mistake here?

kind regards


Torsten


-- Press every key to continue. --


* ** *** ** * ** *** ** * ** *** ** * 
This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they 
are addressed. 
Any views or opinions presented are solely those of the author, and do not 
necessarily  represent those of ESB. 
If you have received this email in error please notify the sender. 
 
Although ESB scans e-mail and attachments for viruses, it does not guarantee 
that either are virus-free and accepts no liability for any damage sustained 
as a result of viruses. 
 
* ** *** ** * ** *** ** * ** *** ** *

Reply via email to