Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Notice: Undefined variable: instance in field_collection_field_widget_embed_validate() (line 1495 of d7/modules/all/field_collection/field_collection.module).
I have a redhen install.
I get this error when:
1. create a relatio
2. add a field collection
3. place a term ref in that field collection
4. make it required or manditory
5. add the relation
When the save button on the contact page is hit, the error comes up.
Comment | File | Size | Author |
---|---|---|---|
#5 | field_collection-notice_undefined-2748177-5.patch | 616 bytes | jamsilver |
|
Comments
Comment #2
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedComment #3
knalstaaf CreditAttribution: knalstaaf commentedI'm getting this with a simple Field Collection field (that's being triggered by a conditional field based on a taxonomy term selected with a list - each term triggers a specific Field Collection field), only containing an (existing) image field and a body field. It occurs when I'm uploading an image.
Edit: I think I figured out what's triggering this error. I have a (required) Field Collection field containing two fields: an image field and a body field <- both required fields as well.
When I upload an image first, the error appears. When I fill out some body text first, and upload an image afterward it does not appear. So it has probably something to do with the validation of required fields.
This behaviour ceases when you make the fields within your Field Collection no longer required.
Comment #4
Road Kill CreditAttribution: Road Kill commentedI am getting this error using 7.x-1.0-beta11+9-dev when I remove an image from an image field that originates from a field collection.
I can also confirm that enabling or disabling required does not solve the problem.
Comment #5
jamsilver CreditAttribution: jamsilver commentedLooks like there's a typo in the code. Looking in the wrong variable for the field instance label. Patch attached.
As a plus, this should fix the form validation error message, which presumably is currently missing the field label.
Comment #6
jmuzz CreditAttribution: jmuzz commentedThanks @jamsilver.
This fix was proposed in #1289062: Required fields in collection not validated when empty which originally introduced the bug. I'll commit it soon.