-
1. Re: selectOneMenu noSelectionLabel not selectable with ajax validation
laixer Mar 24, 2010 9:21 PM (in response to laixer)Still having this problem...
Unless bypassUpdates is disabled, the select will always revert to the previous value.
-
2. Re: selectOneMenu noSelectionLabel not selectable with ajax validation
kragoth Mar 25, 2010 12:13 AM (in response to laixer)Why do you have
bypassUpdates="true"
From the richfaces documentation
bypassUpdates
If "true", after process validations phase it skips updates of model beans on a force render response. It can be used for validating components input
This is just a fundamental problem of the 'null' value and how it is used.
Null is overloaded by almost every application out there to mean too many different things and this is just one of them. So in the JSF world a lot of times null means that the variable has not been initialised yet and thus it should make a call to the appropriate getter to initialise it.
Thus, in your situation because you have specifically said
do not update my bean with the value in this drop down
by setting bypassUpdates to true, the null value of the NoSelectionLabel is causing the getter to fire which is always going to return the last value that posted in which an UpdateModel phase was executed.It would be nice to know why you even have an ajax call on the onchange event for this component.
From what I can see it just looks like an attempt to do input validation. If that's the case then don't bother. Just limit the drop down to the items in the list and they can never be wrong. (Well, almosts never, but ajax validation wont help anyway in the circumstances where a bogus value gets in there). What I mean by this is don't allow users to type values into the drop down.If the input validation is all you are trying to achieve then take out the ajax part completely.
If you are doing anything other then input validation then I fail to see how using bypassUpdates=
true
is the right thing to do. (That doesn't mean there isn't a valid reason for it, I just can't think of it right now :P )I may not have solved your problem, but hopefully I have at least helped you understand
why
it happens.Maybe if you post a little more info about what the ajax is for we can work on a solution :)