In JSF How can I understand of multi checkboxes whether all of them is checked or not?

Posted by Bariscan on Stack Overflow See other posts from Stack Overflow or by Bariscan
Published on 2010-05-26T11:42:02Z Indexed on 2010/05/26 12:51 UTC
Read the original article Hit count: 378

Filed under:
|
|
|
|

As you understand from the title above, I have a datatable and checkboxes in each row.

I want to enable a button when at least one checkbox is selected, and disable it when there is no selected checkboxes (I mean all of them is unselected). I could achieve this as like if one of the checkboxes is selected, the button becomes enable. However, the reversable case I have to do is when the checkboxes is being unselected, when the last selected checbox becomes unselected, the button immediately must become disabled...

BTW, I must do it without using a setter method nor a backing bean. Can I perform it by using jquery or a jsfunction, richfaces, etc?

As a result, I want to learn how I can disable a button at the moment when all of the checkboxes are unselected?

In order to clarify the case, here is my code below;

<h:selectBooleanCheckbox id="selectionCheck" 
    onclick="document.getElementById('form1:button1').disabled=false" 
    value="#{_apiV2Product.selectValue}" > 
</h:selectBooleanCheckbox>

Any help would be appreciated, Many thanks, Baris

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery