-
1. Re: Can the rich:ComboBox component returns the Key of Selec
ma.aqcon May 8, 2008 10:30 AM (in response to danialdy)In the same way as with a standard combo box ...
<rich:comboBox value="#{suggest.property}"> <f:selectItems value="#{suggest.comboSelectItems}" /> </rich:comboBox>
But you might have problems cause of this bug
http://jira.jboss.com/jira/browse/RF-2956?page=all
which is discussed here http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4141244#4141244
Hope that helps ... -
2. Re: Can the rich:ComboBox component returns the Key of Selec
danialdy May 8, 2008 8:54 PM (in response to danialdy)The SelectItem has two property: name and value, and they may have different value:
SelectItem[] suggestItems = {new SelectItem("Credit Card", "CC"), new SelectItem("Cash", "CA")};
I want to get the value, not the name.
Just like the standard h:selectOneMenu does. -
3. Re: Can the rich:ComboBox component returns the Key of Selec
ma.aqcon May 9, 2008 1:54 AM (in response to danialdy)Yes, the method signature of SelectItem constructor has the follwing format
javax.faces.model.SelectItem.SelectItem(Object value, String label)
So if you want to get the value (which is in your example "Credit Card" and "Cash") use the value attribute as mentioned before. -
4. Re: Can the rich:ComboBox component returns the Key of Selec
danialdy May 10, 2008 7:16 AM (in response to danialdy)No, in my example, i want the "Credit Card" or "Cash" be showed, "CC" or "CA" be posted to sever.
-
5. Re: Can the rich:ComboBox component returns the Key of Selec
lucab May 11, 2008 6:47 AM (in response to danialdy)combox is not supposed to work like an HTML select. If you want to use it that way attach to it a converter in order to set your bean with the real value and not the label user sees. After that beware you won't be able to set and submit a default value for that combobox.
You will be able only to set a starting value but that value will be reset to null when you click the submit button.
So, in order to send that value, wich to the user looks like already selected, you should force the user to select it again or do some trick that i couldn't find yet -
6. Re: Can the rich:ComboBox component returns the Key of Selec
danialdy May 12, 2008 12:09 AM (in response to danialdy)Can SuggestBox do this??
-
7. Re: Can the rich:ComboBox component returns the Key of Selec
ilya_shaikovsky May 13, 2008 5:28 AM (in response to danialdy)yes.
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4143150#4143150
Also JS API for Suggestion Box will be introduced in 3.2.1 for more convinient work woth objects.