Thu 17 Nov 2005
One of the helpful little things that most desktop apps know how to do is handle the
shift-click in order to make multiple selections. The place where this is most obviously
missing when it comes to web forms is in a list of checkboxes.
Here is some pretty straightforward, unobtrusive javascript that you can include
in your page that will intercept shift-clicks and make them work. If you click
the first item in a list the shift click some item farther down the list, everything
in between is filled in for you. You don’t have to do anything except include the
javascript file in the head section of your page. All checkboxes on the page
in groups of more than one are automatically taken care of.
When javascript isn’t enabled or the browser doesn’t support what we are
trying to do here, the checkboxes should all work just as they normally do.
Here’a an example with two groups of checkboxes.
One or two caveats about this. When checkboxes are filled in automatically no other
javascript handlers are called. This situation might be detectable and fixed, but that’s
not clear at the moment. Also, if your checkboxes already have onclick handlers for
something they are going to be wiped out and replace. That could use some work
as well.
November 20th, 2007 at 3:51 pm
SHIFT CLICKABLE CHECKBOXES!!!!!!!
YAYYYY!!!!!!!