I'm use Embedded widget with two fields in my Field Collection. I'm create node and fill Field Collection fields. After save node, I'm click Node Edit button and see crashed form (JavaScript don't work properly)

P.S. Sorry for bad English

#16 field_collection-colSpan-fix-1280568-16-7.patch606 bytesbasvanderheijden
PASSED: [[SimpleTest]]: [MySQL] 166 pass(es).
[ View ]


thismax’s picture

Interesting -- I just ran into exactly the same issue, using Field Collection 7.x-1.0-beta2. Any help here would be appreciated.

Javascript error I'm seeing in Chrome:

Uncaught TypeError: Cannot read property 'colSpan' of undefined. tabledrag.js:152

sashken2’s picture

Anybody can help solve this problem?

rlnorthcutt’s picture

I'm hitting the same problem (using the latest dev from Nov. 15th). In Chrome, I am getting these errors:
"Uncaught TypeError: Cannot read property 'colSpan' of undefined
Uncaught TypeError: Cannot read property 'className' of undefined"

From tabledrag.js:149

All other modules and core are updated and seem to be working fine.

rlnorthcutt’s picture


Thanks for the lead here : http://drupal.org/node/1327066, I have a dirty hack for the tabledrag.js that seems to work. It basically just removes the table for the embedded field collection from inspection by JS. Replace line 128 from:

var cell = field.parents('td:first');


var cell = field.parents('td:first:not(.field-widget-field-collection-embed td)');

Obviously this is not a good fix, but it keeps me moving down the road while under a deadline!

kevinquillen’s picture

Confirmed. Definitely a bug. Happens to me too. It breaks any entity form that employs Field Collections and collapsible fieldsets. It also happens if the widget type is Table.

Chrome 17, Drupal 7.10, FC 7.x-1.0-beta3

Is there a way to intercept tabledrag.js actions with jQuery and insert that exception other than hacking core?

kevinquillen’s picture

Following up with #4, you also need to do this for the other FC edit methods:

var cell = field.parents('td:first:not(.field-widget-field-collection-hidden td)');
var cell = field.parents('td:first:not(.field-widget-field-collection-embed td)');
var cell = field.parents('td:first:not(.field-widget-field-collection-table td)');

But you can simplify it for Field Collection by just adding this instead:

var cell = field.parents('td:first:not(.field-type-field-collection td)');

There must be some way to affect this with an external jQuery script without touching core.

The other problem here too, is that row weights are shown without having to click 'Show Row Weights'- which has no effect on FC tables edits.

tim.plunkett’s picture

Priority:Critical» Normal
Status:Active» Postponed (maintainer needs more info)

Can someone provide an export of their content type with Features and attach it here?

Jt Hollister’s picture

Is this something that was never resolved or committed?

deejmer’s picture

I'm still having this issue as well. Focus Field Crop, expanding javascript widgets, etc are all broken. It seems any javascript held inside of the Field Collection is disabled....anyone?

petrovnn’s picture


comment this lines in file:

          if (cell[0].colSpan && cell[0].colSpan > 1) {
            // If this cell has a colspan, mark it so we can reduce the colspan.
          else {
            // Mark this cell so we can hide it.

sorry for hacking core... very sorry...

DIRTY HACK #4 (2011) not working for me now

perelesnyk’s picture

Issue summary:View changes

Have spent a whole load of time debugging this issue. What I think the bug source is line 1431 of field_collection/field_collection.module
If you remove or comment the last condition
&& $instance['widget']['type'] == 'field_collection_embed'
everything works just fine.
Because of this condition there is no proper count correction for the 'field_collection_table' widget type. Thus adding one extra row without proper number of cells (because of wrong delta in field_add_more_js():474, which was 2 instead of 1 for the second item etc.) - and the improper number of cell induced JS crash (in /misc/tabledrag.js).

lonehorseend’s picture

#11 worked well for me, except now the line number is 1469 as of the 4/16/14 dev version.

bjcooper’s picture

#11 worked for me as well. It appears that line of code makes Field Collections in multi-valued fields incompatible with non "field_collection_embed" widgets.

Piratawww’s picture

#11 Works fine! Thxx

samonenko’s picture

#11 worked for me! Thank you!

basvanderheijden’s picture

Status:Postponed (maintainer needs more info)» Patch (to be ported)
new606 bytes
PASSED: [[SimpleTest]]: [MySQL] 166 pass(es).
[ View ]

As so many people ran into the same issue (including me), I've created a patch that you can apply to fix the issue.

tim.plunkett’s picture

Status:Patch (to be ported)» Needs review