Download & Extend

Porting checkall to D6 to optionally enhance "checkboxes" FAPI elements?

Project:Checkall
Version:6.x-2.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Have you thought about porting this module to Drupal 6?

In regards to this comment on the Checkall project page:

(I was informed via email there is other discussion on this at http://drupal.org/node/84961, but I'm not sure where it coincides with Checkall and where Checkall offers something different.)

Drupal 6 includes a "checkall" gadget, but it works only on tables. :(

So, it would be nice to provide an alternative that can be attached to any "checkboxes" FAPI element, specially if it has a lot of options. This is badly needed, and this project seems to be the place to provide such a tool.

Comments

#1

Here's a couple of examples where such a feature would be gold :)

http://drupal.org/node/320555#comment-1111613
http://drupal.org/project/money (the Drupal 6 version also has a big checkboxes element for currencies).

#2

Hi again,

Here's one possible approach. A small javascript is loaded in hook_init() which executes as a Drupal behaviour on page load. Using jQuery, it looks for all .form-checkboxes in the page and if any has more than 10 checkbox elements, then it append "check all / uncheck all" links on top of the checkboxes.

As far as I can see, it doesn't conflict with Drupal's misc/tableselect.js

AttachmentSize
checkall.zip 1.55 KB

#3

Hi Markus,

I have a problem with this sort of Javascript. It's can be real slow. I guess if you only test .form-checkboxes we should be okay.

I made a fix to jsMath in that regard. Mainly, I made it a filter so that way it does not apply to all pages, but only those that the user knows have one or more math formulae.

Thank you.
Alexis Wilke

#4

How about based on an additional property that could be added to the "checkboxes" FAPI element? Maybe something like:

$form['foobar'] = array(
  '#type' => 'checkboxes',
  '#options' => _addresses_country_get(),
  '#default_value' => $default_value,
  '#checkall' => TRUE,
);

This way the javascript file can be included in the page "on demand". The use of checkall would depend on the developer, not the site admin (aka end-user). And this is something that can be altered via form_alter, so it is still possible to write a module that is able to enable/disable this flag for user selected forms, but I see that as an addon of the basic jQuery behaviour.

The ZIP I posted first was just a proof that maybe something could be done...

PS: Thanks for chiming in. :)

#5

Yes. A flag would work great. The only problem is how to document such an extension, I'd say... 8-)

But still, I think that's a good idea.

Thank you.
Alexis

#6

Version:5.x-1.0» 6.x-2.x-dev
Status:active» needs review

I just updated the project page with a new description and also commited the module with the approach as described in #4. I created a -dev release that will be available soon, hopefully, or you can check it out from CVS.

Please, let me know if it covers what you had in mind.

If you add the '#checkall' => TRUE to the countries checkboxes in the address_extras package, I could list your project here as one that uses this checkall thingy.

#7

Status:needs review» fixed

Well, I'm so happy with the new approach that I just released version 2.0. Oh, yeah! :-)

Please, open a separate issue it there's anything else that you wish to see here.

#8

Status:fixed» closed (fixed)
nobody click here