title: Boolean checkbox status update in ManagedBean
body: <p>I have two Boolean type check box in my jsf page from which second check box is made disabled depending upon the first check box status and for first time page loading both the check box are unchecked. I am updating the second check box disable status through script when first check box is checked.Then i am selecting second check box.
         But the problem is when i am submitting my page only first check box status is getting updated. This is my Managed Bean </p>
  
  <pre><code>@ManagedBean(name = "checkBoxTest")
  @SessionScoped
  public class CheckBoxTest {
      private boolean check1;
      private boolean check2;
      public boolean isCheck1() {
          return check1;
      }
      public void setCheck1(boolean check1) {
          this.check1 = check1;
      }
      public boolean isCheck2() {
          return check2;
      }
      public void setCheck2(boolean check2) {
          this.check2 = check2;
      }
      public String update(){
          boolean status = this.isCheck1();
          boolean status2 = this.isCheck2();
          return "checkboxExample.xhtml";
      }
  } 
  </code></pre>
  
  <p>This is my jsf page </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:f="http://java.sun.com/jsf/core"
     xmlns:p="http://primefaces.org/ui"&gt;
     &lt;h:head&gt;
        &lt;title&gt;JSF tutorial&lt;/title&gt;
        &lt;link href="css/styles.css" rel="stylesheet" type="text/css" /&gt;
        &lt;script type="text/javascript" src="js/myFunction.js"&gt;
        &lt;/script&gt;
     &lt;/h:head&gt;
     &lt;h:body&gt;
        &lt;h2&gt;CheckBox Example&lt;/h2&gt;
        &lt;h:form id="form"&gt;
          &lt;h:outputLabel value="First Check"/&gt;
          &lt;h:selectBooleanCheckbox name="check1" id="check1" value="# {checkBoxTest.check1}" onclick="changeCheckBox2Status()"&gt;  &lt;/h:selectBooleanCheckbox&gt;
          &lt;h:outputLabel value="Second Check"/&gt;
          &lt;h:selectBooleanCheckbox name="check2" id="check2" value="#{checkBoxTest.check2}" disabled="#{checkBoxTest.check1?false:true}"&gt;   &lt;/h:selectBooleanCheckbox&gt;
          &lt;h:commandButton action="#{checkBoxTest.update()}" value="Submit2"&gt;
          &lt;/h:commandButton&gt;
        &lt;/h:form&gt;      
     &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My script is given below</p>
  
  <pre><code>function changeCheckBox2Status(){
          var checkBox1Status = document.getElementById("form:check1");
          if(checkBox1Status.checked){
              document.getElementById("form:check2").disabled=false;
          }
      }
  </code></pre>