Comments

Stephen Ollman’s picture

There is a patch for this that does remove, but in my experience it only removes the last item. I'm about to create another issue for that.

https://drupal.org/files/1234574-field-collection-remove-button.patch

priyanka12chavan’s picture

Issue summary: View changes

I have drupal 7.23 with field-collection version - 7.x-1.0-beta7. Whenever remove button is clicked the row is displayed as it is even though entry is not getting saved.
1.Click on add another item
2. Add values in text field for a field collection.
3. Click on remove button
4. fields keep showing along with values.
5. Add another item, now new collection field shows previously values which are entered in previous fields which are supposed to be removed in above step.
I have also tried Patch given here: https://drupal.org/files/1234574-field-collection-remove-button_0.patch
But this is of no use.
it is not showing any JS error in console.
Please help me to solve this issue.

kiliweb’s picture

Thanks Stephen, the patch resolve my issue.
In my experience, it removes the right item with the patch applied.

likewhoa’s picture

Title: Remove button does not remove field item » Remove button does not remove/clear field item(s)
Version: 7.x-1.0-beta5 » 7.x-1.x-dev

This issue is still valid and it's reproducible in -dev version. When clicking the 'remove' button all fields should be empty including file,image fields should be removed as well. Currently 'remove' only works on child items but does not work on the parent item.

Note that patch in first comment is obsolete since field_collection already has most of that code in place. Perhaps it needs to be re-rolled to test if that actually has a fix.

Jon Pugh’s picture

There is a patch for this that does remove, but in my experience it only removes the last item. I'm about to create another issue for that.

https://drupal.org/files/1234574-field-collection-remove-button.patch

Was this "other issue" ever created or resolved?

Whenever I hit "remove" the last item is always the one that gets removed!

likewhoa’s picture

Title: Remove button does not remove/clear field item(s) » Remove button does not remove/clear field correct item(s)
Component: Code » User interface

Whenever I hit "remove" the last item is always the one that gets removed!

I am getting the appositive effect, when ever i hit "remove" the first item is always the one that gets removed! What is going on here lulz

EDIT: ok, my issue is actually not related to fc but multiple_fields_remove_button module, but in fc the remove button is still broken in my case where it doesn't clear the last item's content but can remove secondary items.

Jon Pugh’s picture

jmuzz’s picture

Status: Active » Closed (works as designed)

I think the remove button code in beta8 should be working. What I gather from the comments is that this issue no longer occurs. Please reopen if this is incorrect.

NVaissaud’s picture

Status: Closed (works as designed) » Active

I don't think this issue can be closed yet.

Like i said on Jon Pugh's post, i'm struggling with the same problem.
When i "add another" and delete some fc row item (not the last one), no one disappear.
Then if i save my content form, the last item of my fc has been removed.

At the opposite, when i load my full filled content form and i remove any fc row item, everything works fine.

This problem occurs only when you "add another" and want to remove some row at the same time.

khiminrm’s picture

Hi! I have a similar problem. In my situation I have nested field collections. In my case when I have one parent collection all items of it are removing without problem. But when I add another item of first level, then I have problems of deleting items in first collection. I've made some investigations and found. That items are actauly deleting but the form element doesn't replaced. What I've found that the $element['#id'] in function field_collection_remove_js is correct if I have one parent item. In other case in the code $element['#id'] is the same but in the DOM of page the id has "--2" in the end. For example: in the code I have "edit-field-new-product-und-0-field-replacement-variant", in the DOM "edit-field-new-product-und-0-field-replacement-variant--2". So it didn't replaced. But for the second item I have "edit-field-new-product-und-1-field-replacement-variant" in the code and the same id in the DOM and for this element all items are deleting fine. I am in finding solution how to get the correct id. Maybe someone will have the idea how to resolve this too.

R.Muilwijk’s picture

Still have problems deleting with beta8.

jmuzz’s picture

Status: Active » Postponed (maintainer needs more info)

@khiminrm That's not the behavior described in the issue summary. Lets try to keep tickets focused on one issue. I have created a separate one for yours: #2404153: Remove button breaks in nested field collections

If anybody is still experiencing the problem explained in the issue summary please provide steps that can be taken to reproduce.

jmuzz’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
R.Muilwijk’s picture

Status: Closed (cannot reproduce) » Needs work

To reproduce move the field collection inside a field group programatically or use the multistep module

mekal’s picture

Delete button works for me in beta8 but is broken in beta10...has no effect at all. *I am using field collections on a custom multi-step form but still...works fine in beta8.

jmuzz’s picture

Priority: Critical » Normal

Changing priority as all indications are it is only affecting users using custom code or other contributed modules.

Anybody know if this is happening at all in the latest dev version, or how to reproduce on it?

I'm thinking it might have been fixed by the commit for #2456307: Item Remove Button confuses #parents and #array_parents

jmuzz’s picture

Status: Needs work » Postponed (maintainer needs more info)
Elijah Lynn’s picture

Elijah Lynn’s picture

Elijah Lynn’s picture

Elijah Lynn’s picture