1 Reply Latest reply on Sep 21, 2009 9:48 AM by Alan Chan

    rich:datatable with h:selectonemenu submitted value problem

    Alan Chan Newbie

      Hi, i got a problem that the user selected value in the selectonemenu is reset if validation phase cannot pass. But it only happens inside rich:datatable, if the selectonemenu is put inside the h:datatable or outside table, it can keep the user selected value even validation phase cannot be passed.

      Please see below code:

      <h:form id="testJSFForm">
       <h:inputText value="#{testBean.testInput}" id="nonAjaxName" required="true"/>
       <h:selectOneMenu id="SizeType" styleClass="TEXT_NORMAL" value="#{testBean.testSelectInput}">
       <f:selectItem itemLabel="-- Select --" itemValue="" />
       <f:selectItem itemLabel="value 1" itemValue="1" />
       <f:selectItem itemLabel="value 2" itemValue="2" />
       </h:selectOneMenu>
       <h:message for="nonAjaxName" />
       <h:commandButton action="test2" value="Test success JSF navigation" onclick="frmSubmitData('testJSFForm')"/>
       <rich:spacer height="10" />
      <rich:dataTable
       width="700px" id="carList" rows="5" columnClasses="col"
       value="#{dataTableScrollerBean.allCars}" var="category"
       binding="#{dataTableScrollerBean.carDataTable}" first="0">
       <rich:column id="delCol">
       <f:facet name="header"><h:outputText styleClass="headerText" value="Delete" /></f:facet>
       <h:selectBooleanCheckbox id="isChecked" value="#{category.selected}"/>
       </rich:column>
       <rich:column id="make">
       <f:facet name="header"><h:outputText styleClass="headerText" value="Make" /></f:facet>
       <h:inputText value="#{category.make}" />
       </rich:column>
       <rich:column id="select">
       <f:facet name="header"><h:outputText styleClass="headerText" value="Select" /></f:facet>
       <h:selectOneMenu id="RowSizeType" styleClass="TEXT_NORMAL" value="#{category.selectInput}">
       <f:selectItem itemLabel="-- Select --" itemValue="" />
       <f:selectItem itemLabel="value 1" itemValue="1" />
       <f:selectItem itemLabel="value 2" itemValue="2" />
       </h:selectOneMenu>
       </rich:column>
       </rich:dataTable>
      </h:form>


      When you change the dropdown for both outside the table (id=SizeType) and inside the table (id=RowSizeType), and do not input the textbox (id=nonAjaxName) and press the test2 button, as the textbox is mandatory, so validation cannot pass and stay on the same screen. Then you can see the dropdown outside table can keep the user selected value, but the one inside the table are reset. Changing the rich:datatable to h:datatable works!!!

      My environment:
      Myfaces 1.1.6
      tomahawk 1.1.9
      facelet
      Richfaces 3.1.6 SR1

      Know that 3.1.6 is not supported anymore, but could someone forward me to an JIRA issue about this problem so that i can patch it on my own?

      Thanks a lot.
      Alan