title: JSF Ajax reset previously rendered input component values?
body: <p>I have a small (but vital) problem with JSF and ajax.  The form is here:</p>
  
  <pre><code> &lt;h:form&gt;
          &lt;h:panelGrid id="pg1" columns="2"&gt;
  
              &lt;h:outputText value="Type: "/&gt;
  
              &lt;h:selectOneMenu id="selectOne" value="#{personBean.type}"&gt;
                  &lt;f:selectItems value="#{listBean.personTypes}"/&gt;
                  &lt;f:ajax event="valueChange" render="pg2"/&gt;
              &lt;/h:selectOneMenu&gt; 
  
          &lt;/h:panelGrid&gt;
  
          &lt;h:panelGrid id="pg2" columns="2"&gt;
  
              &lt;h:outputText value="Really bad?" rendered="#{personBean.type=='BAD'}"/&gt;
  
              &lt;h:selectBooleanCheckbox id="checkbox" value="#{personBean.reallyBad}" rendered="#{personBean.type=='BAD'}"&gt;
                  &lt;f:ajax event="click"/&gt;
              &lt;/h:selectBooleanCheckbox&gt;
  
          &lt;/h:panelGrid&gt;
  
          &lt;h:commandButton value="Ajax Submit" action="#{personBean.printValues}"&gt;
              &lt;f:ajax execute="@form"/&gt;
          &lt;/h:commandButton&gt;
      &lt;/h:form&gt;
  </code></pre>
  
  <p>The PersonBean is a simple bean with an enum PersonType that has two values: NICE, BAD and a Boolean called reallyBad. The ListBean returns the enum values in a list to populate the selectOneMenu.  </p>
  
  <p>Basically when I select BAD the panel for the boolean checkbox is rendered where I can tick it to say a person is reallyBad.  I can then submit the form if I wish.  The problem is when I tick the checkbox and then select NICE again, the checkbox is still ticked even though it is not rendered.  So when I submit my form the person can be NICE and reallyBad, which doesn't make sense.  </p>
  
  <p>Rather than having to select BAD again to uncheck the box, is their a way that I can reset the checkbox and its input value to false when NICE is selected?  I'm a bit of a noob to ajax with JSF!  Thanks.</p>
  
  <p>ps. I am printing the values of the two inputs on submit with the commandButtons action to verify the results...</p>