I've created a field collection with four elements.
2 x 'Text' field, with 'Text field' widget
2 X 'Integer' field, with 'Text field' widget
I am using this field collection as part of the signup process. I'm using the Profile2 module, with the profile2_regpath module, that provides a signup page for the various profiles created with the Profile2 module. I've attached the field collection to a Profile2 bundle. I'm also using the field_group module to create vertical tabs, of which the field collection is part of a tab.
So to clarify, the user goes to the signup page for a specific type of profile. The profile is fielded, and one of the fields is the field collection. This field is displayed in a tab created by the field_group module.
The problem: If I add a second instance of the collection using the 'add another item' button, then I click 'delete', the delete button doesn't work, and in firebug I get the error message:
uncaught exception: Syntax error, unrecognized expression: #
There is no line number associated with the error.
If I try to click around the tabs after this, everything collapses into a big drupal error and it has to be refreshed.
Comments
Comment #1
jaypanI've just done some more checking, and the tabs seem to be irrelevant to the issue. I created a fresh profile bundle, and added a single field (a new instance of the field collection mentioned in the first post), with no tabs and/or other fields. The same error appears with this set up as well. I can add a field, but the delete button does not remove the field, and the error appears again.
This Drupal installation is quite vanilla, I've only added this module, a custom module, and the field_group module.
Comment #2
tcalin commentedI have the same problem. I localized the cause here:
After
drupal_process_form($form['#form_id'], $form, $form_state);all the parents of$buttoni.e.$button['#array_parents']are disappearing from the form array. Sodrupal_array_get_nested_value($form, array_slice($button['#array_parents'], 0, -3))returns no element. I will continue the investigations, maybe come up with a patch.Comment #3
tcalin commentedI think we are posting to the wrong place.
This should be a profile2 or profile2_regpath problem.
In the original profile2 form everything works perfect.
Comment #4
tcalin commentedNot a field_collection bug.
I reported the problem here: http://drupal.org/node/1577650
Comment #5
gabrielu commentedI think it might be related to the wrapper id of Field collection.
I am just using field collection to edit a node (node/%/edit).
Gabriel
Comment #6
riseman commentedIf you get form via ajax, there is another solution.
I get hint from somewhere but i can not remember exact issue number.
but key is this.
in field_collection_remove_js function,
required inc file is not included if the parent of field collection is node type.
So, If you get a form by using ajax, you have to add required resources after calling ajax_get_form
Comment #7
jmuzz commentedClosing based on #4.