1 Reply Latest reply on Dec 28, 2008 5:58 AM by nbelaevski

    rich:comboBox getting selected object?!


      I have a rich combobox, which is part of a larger form, and which is populated using a List property from a managed bean. For example:

      <rich:comboBox suggestionValues="#{bean.values}" />

      After submitting the form, I need a reference to a correspoding object, whose value was selected in the combobox. Practicly, I need a reference to an object in a List property, whose value was selected in the combobox.

      I thought to use a binding attribute, and then to get selected object from a HtmlComboBox object after form submision. But, that HtmlComboBox object doesn't have a method which returns a kind of object which I need. It has method getValue() which returns String object with selected value.

      I need references to selected objects because those objects are Hibernate entities from database, and their values (strings) in combobox doesn't identify them.

      As a reference analogy, this is possible with rich:dataTable component. Using binding attribute, I can extract corresponding row, using HtmlDataTable's getRowData() method, which returns a reference to an object from the List, which was used to populate dataTable.