Show off all of the top level checkboxes or radio buttons but hyperlink the term. Click on the term and it will make child terms and form fields visible. The hyperlinks can toggle the visibilitiy, so that-- if you have a lot of terms-- you can hide some of the list.
If no one has seen this done, we will work on it and then post this feature.
All the best,
Mike
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | formtweaker-tree-menu.patch | 5.68 KB | nedjo |
Comments
Comment #1
z.stolar commentedPlease do.
I will apply the patch to CVS when completed.
Comment #2
nedjoHere's a patch to present checkboxes as tree menus.
Instead of relying on hard-coded indentation through incremented css text indents, we output checkboxes in nested ul and li structures (like we do with the menu system). Then we attach the tree menu behavior through javascript. To avoid duplicate coding, I've made this dependent on the Active Menu module. (The code to trigger expand/collapse when the bullet is clicked but not when the item itself is clicked is complex.)
CSS is used to hide the bullets for non-javascript display.
The behavior is: on page load, formtweaker checkboxes are scanned. If they have child terms, they get one of two classes: expanded if they have any checked children, collapsed otherwise. This is so that users don't have to open every part of the tree to discover what is already checked (when editing an existing record or previewing a new one).
Probably we should convert the radios as well. I'll wait first though on some feedback on the approach.
Comment #3
andyschm commentedWOW... Nice patch! Finally, a manageable way to tag with 700+ terms...
Comment #4
z.stolar commentedHi,
I'm in vacation and will happily test and apply all patches as soon as I get back.
Thanks!
Comment #5
nedjoI've found some issues with the patch, mainly concerning validation. I'll post a fixed version when I get a chance.
Comment #6
z.stolar commentedWhat kind of validation issues?
Have a look here: http://drupal.org/node/165799
I'm trying to hunt the issue down. No success for the moment...
Comment #7
nedjoHere the validation issue is that form.inc tests to ensure that the value of each checkbox is a valid key in the parent #options array. In the version of the patch posted above, this test doesn't pass, so we get an error message about an illegal choice.
I've fixed the issue, but I have a different and conflicting patche applied to my formtweaker.module (http://drupal.org/node/165734) so I need to sort out the code to post separate refreshed patches.
Comment #8
andyschm commentedBecause this patch depends on the $(document).ready hook to trigger it will conflict with any other js code that needs to use the same hook.
Comment #9
nedjoAll Drupal behaviours are attached through $(document).ready. In general this shouldn't be an issue--the various processing is done in series.