Support for more field types and empty fields in non-empty rows
| Project: | CCK Fieldgroup Table |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
This touches on some other issues: http://drupal.org/node/159177 and some stuff mentioned in http://drupal.org/node/105736, but I decided to create a new issue because it's not exactly a fix for either.
This patch reworks the way this module works a little by pre and post processing the form items to treat the fields as a grid of non-multiple fields rather than relying on the widget to provide multiple fields.
The effect of this method is that now pulldown widgets work in fieldgroup_tables (as should any other, but that's not thoroughly tested).
Also, if you have an empty value in a row which is not empty, values below that empty field would move up and break your rows, this does not happen with my patch.
I hope this helps other people experiencing these issues.
Thanks
Ronan
| Attachment | Size |
|---|---|
| fieldgroup_table-selectsupport.patch | 4.24 KB |

#1
Here's another version which fixes a warning when there are no fields defined for a group.
#2
I am using Drupal 5.7 with CCK 5.x-1.7 and while I can apply these patches I can't get any fields to display with them. Even if my only field is a Text - Text Field widget, no rows appear, just the table header text and horizontal line. With the first patch I get an error that:
warning: Invalid argument supplied for foreach() in ****/sites/all/modules/fieldgroup_table/fieldgroup_table.module on line 73.
With the second patch I do not see this error, but the rows are still missing. I get the same results with text - text fields or text - select fields.
I will begin looking at the code to see if it's something I can fix. Anyone have any thoughts or experience with this?
#3
The patch in #1 didn't work for me, I had the same issues as @matteusx described.
I moved some lines around, and removed the bogus check for $node->{$group_name}[$field_name] in _fieldgroup_get_deltas(), as $node is not even defined there.
I also removed the 'required' flag when ($delta!=0), meaning that if a field with multiple values is defined as required, only the first one is actually required (normal CCK behaviour).
It seems to work for me now, but I cannot say I fully understand how the code works, so please review carefuly.