Select All Checkboxes

Overview

When a long form is necessary on a page, it can be daunting (not to mention time-intensive) for a user to fill it out completely. This script allows a ‘parent’ checkbox to control the input value of many child checkboxes, potentially saving time and energy clicking each one individually.

The function call to enable this is straightforward. It takes two parameters:

  • parentcheckbox - the id of the parent check box that toggles the rest
  • childboxcontainer - the id of the html container for all child checkboxes
1
2
// initialise the 'select all' checkbox
formUtil.toggleCheckboxes('checkboxall', 'childboxes');