I've got a first pass at creating a way in the CCK UI to make a custom collection of fields that will act together as a single complex field. An example of a way to use this would be to create an 'Address' combo group, comprised of several text fields that are labeled 'Street', 'City', and 'State'. You can set it to multiple values to have more than one address field collection in the node form. All the 'streets' will retain their relationship with the appropriate 'city' and 'state' by keeping the same delta values, and the related fields are grouped together in the form.
Using the fieldgroup patch at http://drupal.org/node/119102, you would:
1) Create a new fieldgroup and give it the type 'Combo'.
2) Set the number of multiple values for the group. All fields in the group will be silently changed to have the same multiple value setting you pick for the group.
3) Drag fields into the group and arrange them however you like.
4) When you edit the node, the module hook_form_alters it to group the delta values of each field together. In other words, the delta and field name are swapped.
5) You can drag n drop each delta group of fields in the node to rearrange them.
6) When you save the form, the fields are massaged back to their regular structure so they get saved properly.
I have made no attempt to get the AHAH add more button working with this, you can select a specific number of multiple values, but not unlimited. For now I am only trying to get simple fields working, so I'm testing with text fields. And for now I'm ignoring problems like what happens if you drag fields with data in and out of the group or try to share the fields. I also haven't tried to alter the display of the node to do the same thing, but it should be fairly easy to create a new template for that.
I don't have more time to spend on this right now, but anyone who is interested in this feature could help move it along. In particular, getting the 'Add more' button working will be a challenge, since it needs to bring back a new form element for every field in the group and add that new collection of fields in without breaking the table drag n drop. It will probably require copying the Content module's 'Add more' code to the fieldgroup module and adapting it.
Note that there's a new theme in the code, so you'll have to rebuild the theme registry to get it working.
Or maybe someone has a different, better way to accomplish this. If so, chime in :)
