6 Replies Latest reply on Aug 5, 2009 6:41 AM by Ilya Shaikovsky

    Changing selected item in rich:comboBox

    Leonid Sokolin Newbie

      I am pretty new to RichFaces and have experienced strange problem in using combo boxes.

      I want the value of one combo box to be controlled by the change in another.

      I managed to achieve that via valueChangeListener call, but I see that only text value is changing and when I click on the drop down arrow of the box, it shows first element selected. I would appreciate, if somebody could advise me how to handle this scenario.

      Please see the code snippet from XHTML file below. Product combo box should drive the value of benchmark.

      <h:outputText value="Product:" />
      <a4j:region>
      <rich:comboBox id="product" width="300" value="#{piQueryToolBean.product}"
      directInputSuggestions="true" immediate="true"
      valueChangeListener="#{piQueryToolBean.changeBenchmark}"
      converter="#{productConverter}">

      <a4j:support event="onselect" reRender="benchmark,benchmarkList" />
      <f:selectItems id="productList" value="#{piQueryToolBean.productList}" />
      </rich:comboBox>
      </a4j:region>
      <rich:message for="product" style="color:red;" />

      <h:outputText value="Benchmark:" />
      <a4j:region>
      <rich:comboBox id="benchmark" width="300" value="#{piQueryToolBean.benchmark}"
      directInputSuggestions="true" immediate="true"
      converter="#{benchmarkConverter}" onlistcall="findBenchmark()" >

      <f:selectItems id="benchmarkList" value="#{piQueryToolBean.benchmarkList}" />
      </rich:comboBox>
      </a4j:region>
      <rich:message for="benchmark" style="color:red;" />