title: Enabling the command button in JSF
body: <p>I have a jsf form which has a command Button and I have some list of items. So i am going to disable the button when user Selected items count is greater than certain limit(assume it as 10) and again it should enable it back if that count is less than 10 . </p>
  
  <p>My code is working till disabling the button but when the count is less than 10 it not able to enable it again .</p>
  
  <p>Pls check my code below and help</p>
  
  <pre><code>&lt;h:commandButton id="addButton"  value="   ADD -- &gt; " action="#{CW.addTraffic}" disabled="false" onclick="return countValidation();"/&gt;
  </code></pre>
  
  <p>In js , i wrote the logic for comparing the count</p>
  
  <p>I should show 3 counts in my page . one is max count which is 10 and selectedcount which is coming when we select items and Permit count which is ..</p>
  
  <pre><code>permitcount= 10 - selectedcount  (this vaklue will becomes neagtive if we select more than 10)
  
  if(permitcount&lt;0)
    {
  
   document.getElementById("main:addButton").disabled='true'; // disable the button 
  
    }
  else
    {
  
       document.getElementById("main:addButton").disabled='false'; // this should enable .
  
    }
  </code></pre>
  
  <p>but it not enabling the button back once it is disabled . pls help me </p>