Search code examples
cakephpformhelper

How to add a select all checkbox


I have this line:

echo $form->input('management_categories',array('options' => $instrumentCategoriesManagement,'type' => 'select','multiple' => 'checkbox','selected' => $management_categories));

How can I add an additional checkbox that says "Select all" at the beginning?

Thanks in advance


Solution

  • I don't know if it works for checkbox:

    echo $form->input('management_categories',array('options' => $instrumentCategoriesManagement,'type' => 'select','multiple' => 'checkbox','selected' => $management_categories,'empty'=>'Select all'));
    

    To actually achieve the effect, you'll need to write js code.