title: Disable/Enable <h:commandButton> on deselecting/selecting <h:selectBooleanCheckBox>
body: <p>I want to disable the submit button on my jsp Page if the user has not agreed to the terms and conditions. I have tried many solutions available but still not getting through. Here is my code :</p>
  
  <pre><code> &lt;h:form id="form2" styleClass="align topLabel page"&gt;
   &lt;h:selectBooleanCheckbox id="check" onclick="document.getElementById('form2:saveForm').disable = !this.checked"/&gt;Agree                 
                  &lt;li class="buttons "&gt;
                      &lt;div class="center"&gt;
                          &lt;h:commandButton id="saveForm" styleClass="btTxt submit"
                              type="submit" value="Submit"
                              action="#{declarationFormBean.formSubmit }"&gt;&lt;/h:commandButton&gt;
                      &lt;/div&gt;
                  &lt;/li&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>Please help.</p>