I installed fieldgroup for a large form, containing over 60 fields, which ultimately were placed into 12 groups.
After spending quite a while putting things into groups and weighting them appropriately (e.g., city, state, zip into an address group, etc.) I was really disappointed to discover that there is no output to match. It wouldn't always be true, but I believe it is often true, that the logical organization created with fieldgroup would be desired in the output, too, at least by default.
As is, city, state, zip for example are not only not together, they are in fact spread out by their individual weight far from one another because they're interspersed with the other 11 groups. This is true in both the "manage fields" screen and in the templates.
I don't rightly know which module would be responsible for honoring the fieldgroup weights . . . it seems like CCK and the content.module is probably where it happens? If fieldgroup is only responsible for creating the weights and I need to ask elsewhere for things to allow the choice of using those weights, I'd sure appreciate a pointer to where this request belongs.
Comment | File | Size | Author |
---|---|---|---|
#27 | cck_fieldset_display_settings_2.patch | 14.01 KB | fago |
#25 | fieldgroup.css_.txt | 94 bytes | yched |
#24 | fieldgroup_display.patch | 13.59 KB | yched |
#22 | cck_fieldgroup_display_settings.patch | 11.59 KB | fago |
Comments
Comment #1
fagoyeah, doing this in 4.7 would require work on the cck module - I also agree the best thing would be fieldgroup support in the cck core.
associated cck issue
Comment #2
fagofor 5.x this should be doable as part of the module
Comment #3
fagoComment #4
KarenS CreditAttribution: KarenS commentedRequested again at http://drupal.org/node/107665.
Comment #5
yched CreditAttribution: yched commentedand again at http://drupal.org/node/108480 :-)
Comment #6
kuahyeow CreditAttribution: kuahyeow commentedSorry for the duplicate.
Just to add my .02 here, it is really odd that fieldgroup has been included into CCK core, but it only changes the input form. Ideally, WYSIWYG should apply here, especially with regards to structure and ordering of elements.
Comment #7
dkruglyak CreditAttribution: dkruglyak commentedAny chance this gets backported to 4.7.x?
Comment #8
kuahyeow CreditAttribution: kuahyeow commentedDon't know, there isn't even a patch to speak of.
Of course, you can soft of workaorund this by using contemplate. [ http://drupal.org/project/contemplate ]
ps. I say, sort of, because, this approach clearly is tedious, when you have move than 5 elements. [have you seen the output?]. Clearly sensible defaults should be applied here.
Comment #9
yched CreditAttribution: yched commentedThe easiest and most logical way considering current implementation (fieldgroup.module acts mainly from the outside) would be to alter the displayed content with hook_content_alter, just the same way the form is altered with hook_form_alter.
But this is 5.0 only, unfortunately. At first glance, having this in 4.7 would require not minor rewrinting.
Comment #10
yched CreditAttribution: yched commentedThis gets a lot of duplicate requests, so I'll get to it. As explained in my previous post, this will be 5.0 only for now.
Comment #11
littleprince CreditAttribution: littleprince commentedOmigosh. This is my #1 issue with this module. I never realized it when I quickly evaluated and started a new site based on Drupal just because of the flexibility I thought the CCK Module would offer. After doing a bunch of work, and than entering a bunch of data, I quickly realized this would be a chore.
I would love to help anyone who wants to work on this, but I am very new to Drupal, and am still finding everything a little confusing.
On a related note, the Fields / Groups should be seperated from Body.
Comment #12
yched CreditAttribution: yched commentedI committed the feature to 5.0 branch
By default it displays fieldgroups as fieldsets (themable), and adds additional 'collapsible' and 'collapsed' for display time.
Maybe we'll want to disable this for teasers, though, and keep only the weighting part (comments welcome)
The new settings require running update.php
Comment #13
littleprince CreditAttribution: littleprince commentedThank you so much for looking into this.
I couldn't get it to work.
I downloaded Drupal 5.1, the latest stable CCK for 5.x, installed them both. I than downloaded the 2 files for 5.x that you committed to CVS and replaced them in the CCK folder. I than ran update.php
When I try to add a group, I get this
user warning: Column count doesn't match value count at row 1 query: INSERT INTO node_group (type_name, group_name, label, settings, weight) VALUES ('lcd_tv_01', 'group_video', 'Video', 'a:2:{s:4:\"form\";a:3:{s:11:\"collapsible\";i:1;s:9:\"collapsed\";i:0;s:11:\"description\";s:0:\"\";}s:7:\"display\";a:3:{s:11:\"collapsible\";i:0;s:9:\"collapsed\";i:0;s:11:\"description\";s:0:\"\";}}', '0', 0) in D:\WebApps\includes\database.mysql.inc on line 172.
I think this is a huge step in the right direction however, and see the huge potential of the display fields tabs.
PS this also didn't work for me when I just patched my working installation and hence the test on a clean install.
Did I do something wrong?
Comment #14
littleprince CreditAttribution: littleprince commentedRemoved a %s, from line 193 in fieldgroup.module seems to fix insertion of a new group.
Haven't tested other parts yet.
Comment #15
yched CreditAttribution: yched commenteddoh. fixed now. thanks :-)
Comment #16
littleprince CreditAttribution: littleprince commentedNo, thank you yched!
You saved me another day of headaches of playing with Drupal to make this work. I will be reviewing your code this weekend and hopefully well learn some insights into the system.
Comment #17
fagogreat work yched, thanks too :)
I've just committed another tiny fix, so that the display fieldgroup uses the appropriate settings (it had used the form settings before).
I would suggest to add the groups to the Display field tab too, so that they can be disabled for teasers too.
Opinions?
Comment #18
yched CreditAttribution: yched commenteddisplay setting fix : Er, right, wrong copy / paste :-/. Thanks.
'display fields' tab : Yes, I think this is the next logical step.
We could provide pseudo-formatters for the fieldgroups (a simple div / a fieldset)
This would incidentally solve the 'do you want fieldsets in your teasers' issue.
Unfortunately, I'm not too familiar with the way Karen included the fieldsets in the 'Manage Fields' tab overview,..
Comment #19
fagoanother idea:
implement the radio buttons, that are proposed in this issue: http://drupal.org/node/101243
Then remove this radio buttons from the edit-group display settings, but move it into the display fields tab by allowing one to select between:
hidden //the complete fieldset + its fields will be hidden
open
collapsible
collapsed
However, the display-description would stay alone in the edit-group form..
Comment #20
yched CreditAttribution: yched commentedYes, that's basically what I had in mind with my 'pseudo formatters'. We'd have something like :
- simple (div)
- fieldset
- fieldset - collapsible
- fieldset - collapsed
- hidden
Whether we shape the UI with radios or dropdown selects is only a matter of choice (even if a select would be more consistent with actual fields formatters :-) )
Comment #21
fagook, I'll have a look at it
Comment #22
fagoattached is the patch - please test: especially if the update procedure keeps correctly the collapsible/collapsed settings.
Comment #23
littleprince CreditAttribution: littleprince commentedWould it be possible to combine this new code with the nested fieldgroup patch?
Comment #24
yched CreditAttribution: yched commentedHere's a new version of the patch :
- update function now directly queries db tables - I had a hard time debugging content and field modules upgrade functions that used API functions (you don't know in update_n what db scheme they rely on), it seems safer to avoid doing so when we can :-)
- simplified the logic in the theme function, to allow easier theming
- removed theme('box'), not flexible enough (no description, no outer div, no attributes) - we provide our own 'simple display' theme function.
- added some margins and padding in a fieldgroup.css file - so tiny it could be integrated directly in content.css ?
(I could not integrate it in the patch, so it will be attached in my next post)
- added another display option : 'no styling' - no visual weez, same display as before my commit in #12 (except for the order of fields)
Comment #25
yched CreditAttribution: yched commentedand the css (remove the .txt extension ...)
Comment #26
yched CreditAttribution: yched commentedBTW, this makes me wonder if we really want the fieldset-style display...
Comment #27
fagoStrange that I had one reject while applying the patch, however attached is another version (including the css file).
- fixed the hidden display
yep, I also thought about this. Aren't fieldset meant for grouping forms?
I looked up the w3c specs and found nothing that prohibits the use of fieldsets without forms, but a div might still suit better.
However I really like the js functionality of fieldsets for display too: e.g. display the fieldset collapsed in the teaser and expanded for full node view: great :)
Of course we could redo that, for a fieldset-display-div, but I suppose that would require a new js file.
Comment #28
yched CreditAttribution: yched commentedWell, I really don't think there's anything wrong with fieldsets in a non-form context. So if we want the functionnality, it's much easier to use core's collapsible fieldsets without reinventing our own collapsible divs. But I was just wondering if it wasn't too much of a gadget,... I guess if you do like the feature, then we have our answer...
I think in most cases users will probably want a no-style or a 'simple' div - but if for any reason a collapsible fieldset comes handy, they'll have to override the theme function for all fieldgroups to get them it, if we don't provide it.
So, all in all, i think this is rtbc :-)
Comment #29
fagoagreed & committed to 5.x and HEAD :)
Comment #30
yched CreditAttribution: yched commentedGreat !
I opened http://drupal.org/node/117132 for the completion of the 'display field' tab overview.
Comment #31
yched CreditAttribution: yched commentedBTW, this is still an open feature request for 4.7 branch...
Comment #32
yched CreditAttribution: yched commentedComment #33
fagoI personally have no interest in implementing this feature in 4.7.x as it would be more complicated then in 5.x. So I set this to won't fix for 4.7 - if anyone else wants to do it, just reopen it.