This is a continuation of the requests in #977890: Display collection fields within entity form (subform/embedded) for a remove button in the embedded widget. Currently the workflow is to blank all fields to remove a collection, but if you have required fields or radio buttons in the collection this isn't possible. I thought it would be helpful to split this into a separate issue now that embedded has been committed to dev, and to try to prevent the previous issue from becoming a catch all for issues with embedded widget.

Comments

vasike’s picture

i can confirm this

daniel.tyree’s picture

just a follow up to the issue. this isn't just a problem with removing ones with required fields. the problem also exist if you are simply editing an entity with a field collection in it that has required fields. right now the default is to always have a blank 'new' field collection at the end (or unlimited values). I think this could be fixed by only adding the new field collection form if the add more button was pushed.

just for an example:
i have a field collection degree that contains 3 required fields (school, program, type). this is an unlimited values field in my profile. if a user needs to edit their profile for lets say changing their name, upon saving it will say that required fields haven't been filled out due to the blank field collection form that contains required fields.

this is doing what it is suppose to in some respect of making sure required values are filled out. however, there wasn't a need for a new field collection form as the user didn't intend on adding a new degree field collection.

RobW’s picture

Title: Cannot remove collections with required fields when using embedded widget: collections need a remove button. » Required fields cause problems with unlimited field collections: request for remove button and unlimited-aware validation

@dainel: Good catch, I have ran into that myself. Editing title to reflect.

One thing I'd like to point out is the standard pattern for all unlimited fields in Drupal is an empty field at the bottom and then an add more button. Personally, I would rather all unlimited fields display the last filled field and an add more button, but in the interests of Drupal consistency field collection should probably follow the established pattern.

Thinking about it, this could be difficult. If you have a field collection entirely of radio buttons with default values, how would there be any way to tell if the last collection was a user's intended choice or a "blank", don't add me field collection?

WilliamB’s picture

Subscribe, just ran into the same issue.
I too would prefer that it displays the last filled field and an add more button, insetad of an extra empty field.

afeijo’s picture

sub
I also need to remove the blank line when editing a node
and the Remove link next to each one!

RobW’s picture

Looks like there's a patch for a delete button over here: #1234574: Add a delete button on the field-collection item edit form. Give it a test!

jared12’s picture

If I understand this topic correctly, I believe the issue I'm having is related to the need for "unlimited-aware validation."

I have an unlimited field collection that consists of a text field and a boolean check box. Every time the node is edited and saved a new blank instance of the collection is generated. (Neither field is required.)

rocklounger’s picture

I have the same problems as the jared12. Need "Remove" button

zilverdistel’s picture

subscribe

afeijo’s picture

@RobW at #6

That issue & patch #1234574: Add a delete button on the field-collection item edit form is not related to what this issue ask for, it is just a redundant delete button to the item edit form

I made a jQuery script that add the delete button next to each multiple value, but that is just half the solution, since if the user hit the Add another Value button, the deleted one returns :p
my jQuery could use a livequery and delete the row again, not the best solution but ... I will try and if it works I will share my code with you all

tim.plunkett’s picture

heivoll’s picture

Subscribe.

alexgl’s picture

Priority: Normal » Major

I have same issue with not only required fields but fields in general in the embedded widget. as of latest build at this time I get this error "An illegal choice has been detected." when hitting "add another" button.
In my field collection, I have, in order: 2 text fields, 1 long text + summary, 1 list (text), 1 text field, 1 number field.

If I may be so bold, I'd like to elevate priority of this, since it seems as a showstopper for field collections.

alexgl’s picture

I figured out what was causing an issue:
in form.inc @ line 1289 elseif (!isset($options[$elements['#value']])) {

a list field was cause an issue because it was lacking a 'value' entry in the array that is expected. This list field was using the checkbox/radio buttons widget. After I changed it to a list(text) list select widget, the repeatable field/field collection is working properly now.

bryancasler’s picture

subscribe

FreeFox’s picture

Same issue here. I'll check the behaviours of Drupal core and this module and than see what I can do.

However, in my opinion, a delete/remove button for a field-collection is a must.
The patch for the delete button above doesn't seem to work when the "field collection table" module is installed.
Looking into that one too.

tim.plunkett’s picture

Title: Required fields cause problems with unlimited field collections: request for remove button and unlimited-aware validation » Request for remove button

We're definitely going to need to focus this. "Unlimited-aware validation" should be a separate issue.

tim.plunkett’s picture

I marked #1208030: Embedded widget: remove item with required select not possible as a duplicate, it is an example of why this is a major bug and not a feature request.

drupov’s picture

subscribe

Fidelix’s picture

Subscribing... This is really needed.

zengenuity’s picture

Subscribe

tim.plunkett’s picture

Title: Request for remove button » Allow for deletion of a single value of a multiple value field

Mirroring the core issue. I'd like to think this would be fixed in core first, but it might not be backportable, so we'll likely have to do this ourselves anyway.

isaac77’s picture

subscribe

marcushenningsen’s picture

subscribing

jfinkel’s picture

subscribe

mishac’s picture

subscribe

Refineo’s picture

subscribe

leup’s picture

subscribe

sachbearbeiter’s picture

sub

jbova’s picture

sub

bastnic’s picture

sub

rp7’s picture

subscribe

JulianH’s picture

subscribe

dww’s picture

I don't understand how this issue is different from #1234574: Add a delete button on the field-collection item edit form. Whenever you're editing an entity that has a multi-valued field_collection field you can now delete specific field_collection entities via a delete button. Isn't that what this issue is trying to accomplish? Shouldn't we mark this issue duplicate?

Thanks,
-Derek

tim.plunkett’s picture

Status: Active » Closed (duplicate)

Agreed.

FreeFox’s picture

Just downloaded de dev version of NOV 15 and ... patch is already committed and it works great.

Thanks Merlin