I have recently done something similar
you have to create some javascript for the form.
and also another checkbox or button to check all. the values will be the value of the check box
function handler1() {
$(“form input[type=‘checkbox’]”).attr ( “checked” , true );
$(this).one(“click”, handler2);
for (i = 1; i < +trows; i++) {
nm_check_insert(i);do_ajax_form_ppb_approval_event_checkbox__onclick(i);
}
}
function handler2() {
$("form input[type='checkbox']").attr ( "checked" , false );
$(this).one("click", handler1);
location.reload(true);
}
$("#hidden_field_label_checkbox_").one(“click”, handler1);
my code may help you but i use it on a form rows.