As stated by Dmitry from Openfaces, Enabling/Disabling a faces components (Primefaces, Openfaces, Richfaces...etc) must be done on server side.
A better solution is henceforth to use ajax when a change event is fired! onchange event is suitable for this situation (imagine the checkbox is checked/unchecked using Keyboard for example)!
<h:selecBooleanCheckbox id="box" value="#{mybean.selecteditem.booleanvalue}"......>
<f:ajax execute="box" render="but" event="change" />
</h:selectBooleanCheckbox>
<h:commandButton id="but" action="someAction" value="someValue" disabled="#{!mybean.selecteditem.booleanvalue}" />
This way, when the checkbox is unchecked, the command Button is disabled, but when checked the button is enabled.
In the case of Primefaces using <p:ajax />
is recommended!
<p:ajax event="change" process="box" update="but"/>
In case of OpenFaces, both <f:ajax />
and <o:ajax />
work fine.
And if you have multiple components to render at the same time, juste include their ids, space separated :
<f:ajax ......render="id1 id2 id3" />