[development] JS gurus: please help me check checkboxes with a checkbox ; )

Steven Wittens steven at acko.net
Mon Mar 27 19:03:44 UTC 2006


You'll need to figure out how to deal with unchecking though... if both 
module type A and module type B require hook C, then what happens if I 
check A, check B, then uncheck A?

You can solve this in a really really dirty way ;). Javascript allows 
you to extend objects arbitrarily. So you can just add a checked count 
to the checkbox elements which is incremented every time the checkbox is 
programmatically checked, and decremented if it is programmatically 
unchecked. You only actually uncheck it if the counter reaches 0.

See attached file.

Steven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20060327/1252037e/test.html


More information about the development mailing list