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 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.
Comment | File | Size | Author |
---|---|---|---|
#1 | field_collection-fix-nested-remove-button-2082635-1.patch | 859 bytes | klaasvw |
Comments
Comment #1
klaasvw CreditAttribution: klaasvw commentedThe 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).
Comment #2
bradallenfisher CreditAttribution: bradallenfisher commentedI 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...
Comment #3
bradallenfisher CreditAttribution: bradallenfisher commentedLatest dev fixes my issues. THANKS!
Comment #4
jmuzz CreditAttribution: jmuzz commentedThanks.
The current version has this fix.