When a field collection is nested into another form hierarchy with its parents not having '#tree' => TRUE the remove button for multiple values results in wrong values.

This can be reproduced using the webform_entity module. When using a multi value field collection field the remove button won't work as expected.

Steps to reproduce:

  • Install webform_entity
  • Set up a content type to use webform entity (form_tester)
  • Set up a webform entity content type (form_tester_fields)
  • Add a field collection to the form_tester_fields content type that can have unlimited values
  • Create a form_tester node with a webform
  • Fill out the webform and add three field collection items
  • Delete the second item

Result: The values of the deleted item are partly copied to the remaining items.

Patch will follow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

klaasvw’s picture

Status: Active » Needs review
FileSize
859 bytes

The following patch makes sure the remove button works when the form state value hierarchy doesn't match the form hierarchy (e.g. when using webform_entity).

bradallenfisher’s picture

Issue summary: View changes

I am seeing this as well. However, I am not using webform_entity.
I have nested items that are multiple values. When i click the remove button, the node/edit/form shows that the field collection for that row was removed properly, however upon save other values in the parent row are removed...

bradallenfisher’s picture

Latest dev fixes my issues. THANKS!

jmuzz’s picture

Status: Needs review » Closed (outdated)
Related issues: +#2456307: Item Remove Button confuses #parents and #array_parents

Thanks.

The current version has this fix.