Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When "Add another item" is clicked on a multi field collection table, I get a Javascript error "TypeError: cell[0] is undefined" in line 153 of tabledrag.js. This breaks table dragging and ajax functionality completely.
I can see the problem is that there are missing <tr>s inside <thead>. So far, I have not found a solution. I will post a follow up if I get to the bottom of this.
Comment | File | Size | Author |
---|---|---|---|
#9 | tableview.jpg | 76.22 KB | yenidem |
#4 | field_collection_table_error.jpg | 98.1 KB | Nick Robillard |
Comments
Comment #1
Nick Robillard CreditAttribution: Nick Robillard commentedThis seems to be the fault of Editablefields module.
Comment #2
Nick Robillard CreditAttribution: Nick Robillard commented(Edited to avoid confusion)
Comment #3
Nick Robillard CreditAttribution: Nick Robillard commentedClosing.
Comment #4
Nick Robillard CreditAttribution: Nick Robillard commentedAnd I'm back. :)
I have disabled Editablefields module and I am still getting the aforementioned Javascript error as well as a blank row being inserted when Add Another Item is clicked.
I have tested with both the latest dev versions of Field Collection as well as Field Collection Table. I have also tested with the latest stable versions of both, Field Collection 7.x-1.0-beta5 and Field Collection Table 7.x-1.0-beta1. I am using Entity 7.x-1.0. I have a nearly out of the box Drupal 7.18 setup here. Is no one else seeing this?
Attached is a screenshot of a node edit page. You can see the buggered table row, as well as the tabledrag.js error.
Steps to reproduce:
Comment #5
Nick Robillard CreditAttribution: Nick Robillard commentedAaaand another update. This issue goes away with Field Collection beta 2 (as this project page says). However, that is really unfortunate, as the latest Field Collection beta 5 has lots of new/improved functionality (like Remove links and revisions). I don't see much action here and deadlines are coming, so I've forked Field Collection beta 2 and will continue to port more recent Field Collection functionality back to beta 2. This sucks because anything I do now is pretty much useless to the community. O well, c'est la vie.
Comment #6
yenidem CreditAttribution: yenidem commentedI have same problem, I tried latest dev version but problem has not solved. Please advice.
Comment #7
yenidem CreditAttribution: yenidem commentedNick,
As ı specified at#6 I had same problem. Now, I changed widget type as "embed" and style the fields by CSS, this is works for now. you can try it this solution at this moment.
Comment #8
Nick Robillard CreditAttribution: Nick Robillard commentedSure, Embedded works but I need Tables.
Comment #9
yenidem CreditAttribution: yenidem commentedNick,
OK, we need table as well but see the attached screenshot. I use embedded widget as editing form and I use table format as view.
and please note that divs and spans better than tables. I stylize with css and editing form looking as table, I have not finished styling yet. This is temporary solution until problem solved.
Comment #10
Lynnwood CreditAttribution: Lynnwood commentedyenidem,
I've having the same issue. I'd like to get your css tweaks as temporary fix for issue if you're willing to post them here. Thanks - Lynnwood
Comment #11
Phizes CreditAttribution: Phizes commentedI have found field collection table works fine with field collection 7.x-1.0-beta4, I'm not sure if beta4 has new features over beta2 though.
I have the need to fix this, but I am just short on time at the moment.
Comment #12
kris-o3 CreditAttribution: kris-o3 commentedalso experiencing this issue, both in beta1 and dev versions of field_collection_table...
downgrading to beta4 of field_collection seems to resolve this.
Comment #13
kris-o3 CreditAttribution: kris-o3 commentedif you DO downgrade to field_collection beta4, you'll have to make some changes to the database manually...
http://drupal.org/node/1783456#comment-7014142
Comment #14
Itangalo CreditAttribution: Itangalo commentedThis is possibly a duplicate of #1780394: The table header disappear when there is a validation errorHeader
Comment #15
Itangalo CreditAttribution: Itangalo commentedMore information:
Field Collection pretty recently added a setting "Hide blank items", which removes the last (empty) field item on multiple-value fields.
This setting is enabled by default, and the setting also causes Field Collection Table to whack out (as described in this issue). At least, disabling this setting made things work just fine for me.
I don't know if the setting accidentally removes things that really should be there, or if Field Collection Table expects things to be in a place where they not always are. So I don't know if this is an issue for Field Collection or Field Collection Table.
I get two error logs when the table fails to add another item:
and
I hope this can help to shed some light on the issue.
Comment #16
Itangalo CreditAttribution: Itangalo commented(stupid double-post, sorry)
Comment #17
yogaf CreditAttribution: yogaf commentedThanks Itangalo,
Un-checking "Hide blank items" fixed things for me.
Comment #18
Phizes CreditAttribution: Phizes commentedI think this may be a duplicate: #1815496: Using "Hide blank items" leads to misformed tables
Using field_collection_table-7.x-1.0-beta1 and field_collection-7.x-1.0-beta5: I copied field_collection_field_attach_form() into a miscellaneous module, and renamed it, and changed 'field_collection_embed' to 'field_collection_table'. This is as mentioned in the above issue, not clean, but by being in a seperate module it does avoid hacking field_collection_table for now.
We were already using a workaround for the addition of empty elements, so it actually turned out cleaner for us to leave it enabled and do this instead.
Comment #19
RossP-1 CreditAttribution: RossP-1 commentedThank you yogaf. I went to structure->content types->MYTYPE->manage fields->edit on MY_FIELD_COLLECTION and unchecked "Hide blank items" in the field settings at the bottom of the page. The misformatting and errors that occured when adding new rows to add content in field collection tables went away. You really made my day!
Comment #20
capellicSo then this is a Field Collection problem and not a Field Collection Table problem, right? Thanks to post #15 above for the tip I needed. I can confirm that unchecking "Hide blank items" resolves the problem-- but of course now I have an empty field collection row on my nodes forms. And why doesn't there seem to a be case for this in the Field Collection module issue queue?
Comment #21
rooby CreditAttribution: rooby commentedRemoving tag - it is not related to editable fields as I am not using it and have the problem.
Comment #22
FiNeX CreditAttribution: FiNeX commentedI also confirm the bug. It is not related to editable fields.
Comment #23
braindrift CreditAttribution: braindrift commentedI have the same issue without using editable fields. Problem seems only to appear if "Hide blank items" is enabled in field settings.
Comment #24
Linked25 CreditAttribution: Linked25 commentedyenidem,
Would you mind horribly posting your css so we can use your fix? I tried recreating what you have and haven't had much luck with it.
Comment #25
Phizes CreditAttribution: Phizes commentedThis really is a duplicate of #1815496: Using "Hide blank items" leads to misformed tables
Comment #25.0
Phizes CreditAttribution: Phizes commentedupdating description