How to enable a button when a checkbox is selected, without a setter nor a backing bean
posted 5 years ago
It is my first post, wish me good luck
I am developing a web app using Seam, JSF, EJB3, hibernate.
I have a datatable, and checkboxes in each row. In order to clearify it, I attached my code below:
As you see, there are a number of checkboxes will be rendered as the datatable iterates resultList.
When a checkbox is selected, the "selectValue" (which is a 'transient' boolean property of the entity apiV2Product) will be set if only a command button is clicked or another action is performed.
It is what I want. User selects checkboxes in the client side, and it does not goes setter of "selectValue" on each selection, but goes and set the related values only an action performed (like a button clicked)
So far, my problem is, I want to enable a buton when at least one checkbox is selected without calling a setter or an action.
On the other hand, I dont know how to manage if none of the checkboxes is selected or not.
Because, in my case, the point is when none of the checkboxes is selected, button will be disable. And even if one of the checkboxes is selected, button must be enable indeed.
Is there any approach to this case you know? Is it possible by using Jquery or jsFunction, richfaces, etc.?
Any help would be appreciated