This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes f:ajax to update h:selectOneMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "f:ajax to update h:selectOneMenu" Watch "f:ajax to update h:selectOneMenu" New topic
Author

f:ajax to update h:selectOneMenu

Carlos Jorge Tavares Ferreira
Greenhorn

Joined: Dec 10, 2007
Posts: 17
Hi,

I'm trying to use an ajax event to update the values of a selectOneMenu.

With some workaround I was able to update the values (where can I see a good example on how to do this?),
but when I submit the form I'm getting a validation error on the component (javax.faces.component.UISelectOne.INVALID).

I'm doing this the wrong way, no doubt about it, it shouldn't be so complex:









What can I do to improve the code?

Kind regards,

Carlos Ferreira
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959
    
  19

It's required that whatever value you have in the target value of a Select control must be in the SelectItems collection. If you change the SelectItems and the old selected value isn't in the new SelectItems, you need to reset the selected value to blank, null, or an appropriate pre-selection (that is, something that's in the new SelectItems list).


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: f:ajax to update h:selectOneMenu
 
Similar Threads
Update another component when selectOneMenu
h:selectOneMenu breaking up in IE 9
Ajax Listener does not get called properly
Problem in JSF
How to auto-render a GUI using Ajax