I am trying to select multiple checkboxes with a single checkbox. I am using javascript to do it.
function selectAllCheckboxes(cb) {
var inputs = document.getElementById('table').getElementsByTagName(
'input');
for ( var i = 0; i < inputs.length; i++) {
if (inputs[i].className != null && inputs[i].className != undefined
&& inputs[i].className == 'requiredCheckbox') {
inputs[i].checked = cb.checked;
}
}
}
Below is the HTML code of the select all checkbox
<input type="checkbox" id="selectAll" onclick="selectAllCheckboxes(this);return true;">
The checkboxes are similar to below
<h:selectBooleanCheckbox value="#{anObject.checkboxSelected}"
styleClass="requiredCheckbox" />
With the above set up, I am able to check or uncheck all the checkboxes. However, when I try to submit to the actionListener
I am getting error below error
JSF1054: (Phase ID: RESTORE_VIEW 1, View ID: ) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@1033971] .. Exception in the filter chain: javax.servlet.ServletException: Parameters processing failed. .. java.lang.IllegalStateException: Parameters processing failed. .. ..
Please note that if I manually click the checkboxes and submit, it works fine.
Please let me know how to fix this.
Aucun commentaire:
Enregistrer un commentaire