1 Reply Latest reply on Feb 24, 2012 6:21 PM by Maheswara Sunkara

    selectOneRadio not taking value to backing bean

    parthi ban Newbie

      Hi,

       

      I have a requirement, In a page user clicks on close button, a pop up will be called to choose ay of the radio values.

       

      here is the code..

       

      payrollDetail.xhtml

       

      <a4j:commandButton value="Close" actionListener="#{payrollDetailBean.retrieveRequestStatus}"

                                                          onclick="#{rich:component('RequestStatusPopUp')}.show();"/>

       

      This button call action listener before call the popup to get the staus from the database.

       

      <rich:popupPanel id="RequestStatusPopUp" model="true" styleClass="tablecenter" autosized="true">

                          <f:facet name="header"><h:outputText value="Status Update"/> </f:facet>

                          <div>

                          <h:panelGrid columns="3">

                              <center>

                                  <h:selectOneRadio value="#{payrollDetailBean.requestStatus}" valueChangeListener="#{payrollDetailBean.statusChange}">

                                      <f:selectItem itemValue="I" itemLabel="InComplete" />

                                      <f:selectItem itemValue="C" itemLabel="Complete" />

                                      <f:selectItem itemValue="U" itemLabel="Unable to Complete" />

                                  </h:selectOneRadio>

                         

                                 

                                  <a4j:commandButton value="OK" action="#{payrollDetailBean.updateReqStatus}"/>

                                  <a4j:commandButton value="CLOSE">

                                      <rich:componentControl target="RequestStatusPopUp" event="click" operation="hide" />

                                  </a4j:commandButton>

                                  </center>

                             

                          </h:panelGrid>

                          </div>

                       </rich:popupPanel>

       

      PayrollDetailBean.java

       

      public String updateReqStatus(){

              // update the new changed request status

              if(!StringUtils.equals(requestStatus, getRequestStatus())){

                  wageService.updateRequestStatus(getParamRequestId(), getParamReplyId(), getReqStatus());

              }

              return "searchResult";

          }

       

      public void statusChange(ValueChangeEvent event){

              if(event.getNewValue() != null){

                  reqStatus = event.getNewValue().toString();

              }

         }

       

      When I click OK button, the action method is called but ti has no value.

       

      When I click the CLOSE button, the form is submitting twice and values are null. Could anyone help me to identify the problem???