Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Automate unchecking checkboxes

Parent Feed: 

I'm doing some testing of an upgrade for a site from Drupal 4.7.x to 5.x. As part of the major version upgrades in Drupal, you're supposed to disable all the modules you have installed. Since I got tired of unchecking boxes, I used the Greasemonkey addon for Firefox 2 to do it for me.

Once the addon is installed, right click on the monkey face in your status bar and make a new user script.

name: Uncheck Boxes
namespace: uncheck_boxes
description: Unchecks all checkboxes that are enabled by default
include: http://yourtestlocation/admin/modules

When you hit ok, your default text editor will ask you for script content.

// ==UserScript==
// @name           Uncheck Boxes
// @namespace      uncheck_boxes
// @description    Unchecks all checkboxes enabled by default
// @include        http://davidnorman.local/test25/admin/modules
// ==/UserScript==

var chkboxes=document.getElementsByTagName('input')
for (var i=0; i < chkboxes.length; i++) {
  if (chkboxes[i].type=="checkbox") {
    chkboxes[i].checked=false
  }
}

That's it! Reload your modules page and all the checkboxes should be unchecked by default. When you're done disabling, you can right click the monkey face and uncheck your Uncheck Boxes script, disable Greasemonkey, or leave it available for other sites you want to uncheck by default.

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web