-
1. Re: Problem using selectOneMenu in jenerating dynamic select
monkeyden May 13, 2007 11:32 AM (in response to ask4saif)In JSF, it is required that the submitted values for select boxes are a subset of the original SelectItems. In other words, if you have values 1,2,3,4,5 displayed in a select box, the submitted values need to be some subset of 1,2,3,4,5, and any value other than these is invalid. You have a few options:
1. In the value change listener, try to modify the list the receiving selectbox uses and use immediate=true on it. I haven't gotten this to work. JSF doesn't update the values in the component tree for some reason.
2. Write your own JSF component which consists of two select boxes and two buttons (Add/Remove), something like the Tomahawk component.
http://www.irian.at/myfaces-sandbox/picklist.jsf
3. Do it strictly client side, parse the values in JavaScript and submit in a hidden field, and parse on the server side. This is the most distasteful. -
2. Re: Problem using selectOneMenu in jenerating dynamic select
ask4saif May 13, 2007 2:38 PM (in response to ask4saif)thank you dear for your help,
I have 2 drop down lists:
1. country
2. states
In the first list of country i use a factory method retuning selectItems to jsf component. when any country from the list is selected i use seam remoting to tranfer the country to EJBs and get the respective states in seam remoting. then i parse the result in javascript and i update the jsf 2nd selectOneMenu.I am not using jsf valueChangeEvent.
untill here all of the values populate in the list successfully.
but when i submit the values, the state component give me error message "value is not valid".
I dont know why it is telling that the value is invalid when the process that i did was working fine, accept the error message.
thank you,