How to provide ‘Select all checkboxes’ option in Drupal 7

Drupal has provided Form API’s to create checkboxes easily unfortunately it didn’t offer a select all / deselect all checkboxes option.

But no worries, there are plenty of contributed modules are present in Drupal site which will help us to extend the Drupal functionality. ¬†One of the module which we are going to use it called ‘checkall’ module. Please click the below link to see the module:

https://www.drupal.org/project/checkall

The above module gives us “check all” / “toggle” / “uncheck all” actions to the checkbox group. Let’s see how to activate this in a form.

Step 1:

First install and activate the module.
checkall-modules

Step 2:

Then ‘Add a new field’ in the Article content type as shown below:

article-drupal

Step 3:

Add some values in the list as shown below:

checkbox-step2

Step 4:

Finally Enable the below option and in the field settings select ‘Unlimted’:

enable-checkall

That’s it you have successfully enabled the checkall option for the check-boxes.

Let’s see how it displays in the article section

checkall-in-article

That’s it friends, kindly share this post if you liked it.

Add a Comment

Your email address will not be published. Required fields are marked *