title: How to keep values selectOneMenu ' s <p:ajax> updating panel
body: <p>I have an selectOneMenu and when Its value at 0, I want to "Add" button does not show up. I have rendered for this situation. Here is code ;</p>
  
  <pre><code>&lt;p:panelGrid id="pnlRegister" columns="6" style="width: 95%" &gt;
       &lt;p:inputText id="name" class=" width100" value="#{register.name}" /&gt;
  
       &lt;p:selectOneMenu id="numberOfChild" value="#{register.numberOfChild}" &gt;
               &lt;p:ajax listener="#{register.listenNumberOfChild()}" update="pnlRegister" /&gt;
               &lt;f:selectItem itemValue="0" itemLabel="0" /&gt;
               &lt;f:selectItem itemValue="1" itemLabel="1" /&gt;
               &lt;f:selectItem itemValue="2" itemLabel="2" /&gt;
               &lt;f:selectItem itemValue="3" itemLabel="3" /&gt;
               &lt;f:selectItem itemValue="4" itemLabel="4" /&gt;
               &lt;f:selectItem itemValue="5" itemLabel="5" /&gt;
       &lt;/p:selectOneMenu&gt; 
       &lt;p:commandButton id="addPerson" value="Add" actionListener="#{register.openPersonDialog(1)}" rendered="#{register.visibleAddPersonButton}"  &gt;
               &lt;p:ajax event="dialogReturn" update="pnlPerson" /&gt; 
       &lt;/p:commandButton&gt;
  </code></pre>
  
  <p>And Bean code;</p>
  
  <pre><code>public void listenNumberOfChild() {
      if (numberOfChild == 0) {
          visibleAddPersonButton = false;
      } else {
          visibleAddPersonButton = true;
      }       
  
      System.out.println("ListenerNumberOfChild " + numberOfChild);
  }
  &lt;/panelGrid&gt;
  </code></pre>
  
  <p>Now problem is, when I change numberOfChild, listener works uptades pnlRegister as expected. However server does not keep inputText values. For example before listener works, I write register.name as "John". After listener works, it does not keep it and it gets as null. I hope I could tell what I'm trying and what is problem. So do you have any suggestion ? Also I tried RequestContext.getCurrentInstance().update but same problem occured. </p>