2 Replies Latest reply on Dec 15, 2010 8:51 AM by utish

    Problem with h:selectOneMenu in rich:modalPanel

    utish

      I'm using Richfaces 3.3.1.

       

      I've a h:selectOneMenu in my modal panel as shown below:

       

       

      <a4j:region>
      <h:selectOneMenu id="Race4E1" value="#{nFIRS4_SectionE1.currentRace}" >
      <f:selectItems value="#{nFIRS4_SectionE1.race}"/>
      </h:selectOneMenu>
      </a4j:region>
      <a4j:region>
           <h:selectOneMenu id="Race4E1" value="#{nFIRS4_SectionE1.currentRace}" >
           <a4j:support ajaxSingle="true" event="onchange"/>
           <f:selectItems value="#{nFIRS4_SectionE1.race}"/>
           </h:selectOneMenu>
      </a4j:region>
      

       

       

      When I change in a value in my drop down, the value is set in my backing bean:

       

       

      public void setCurrentRace(String currentRace) {
           this.currentRace = currentRace;
      }
      

       

       

      When I submit my modalPanel, I run a validator to check for my validation errors and open an error dialog if a data validation occurs.

       

      <a4j:commandButton 
               action="#{nfirs4PopupManager.addCivilianFireCasualty()}" 
                id="nfirs4_submit" value="Save" 
                oncomplete="#{nfirs4PopupValidator.errorsPresent} ? 
                          #{rich:component('error4ModalPanel')}.show() : 
                          #{rich:component('civilianFireCasualtyModalPanel')}.hide()"  
                />
      

       

       

      My problem is when I submit the modal panel, it goes back to setCurrentRace(String currentRace) and sets the input parameter String currentRace to null and my value in the drop down (from the h:selectOneMenu above) is lost. If I change the component to h:inputText, it does not go back to setCurrentRace(String currentRace) and my values are properly saved.