I'm using a content type A with a multivalue field collection field. The field collection has two taxonomy fields, the second one being limited by the values in the first one. I'm using entity reference to reference these fields.
I can add data to the field collection in two ways:
1/ When adding content of this content type (node/add/A), I get these notices
Notice: Undefined index: #default_value in reference_option_limit_form_alter() (regel 291 van public_html/sites/all/modules/reference_option_limit/reference_option_limit.module).
Notice: Undefined index: #default_value in reference_option_limit_form_alter() (regel 301 van public_html/sites/all/modules/reference_option_limit/reference_option_limit.module).
Notice: Undefined index: und in reference_option_limit_form_alter() (regel 355 van public_html/sites/all/modules/reference_option_limit/reference_option_limit.module).Limiting options doesn't work here, nothing happens when selecting a value.
2/ When viewing content of type A, I can add a field collection from that page (field-collection/field-X/add/node/1). Here the limiting works when selecting a value, but only once. When I choose another value, the limited field doesn't update.
I'm not sure what's causing these problems, both field_collection and reference_option_limit are fairly new to me.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | reference_option_limit.zip | 27.14 KB | ykyuen |
| #12 | field-collection-fixed-1624378-1.patch | 42.36 KB | ykyuen |
| #8 | reference_option_limit_1624378-7.tar_.gz | 11.87 KB | miiimooo |
Comments
Comment #1
miiimoooBumping this
Comment #2
jhuon commentedSame problem here, using Reference option limit 7.x-1.1 with Field collection 7.x-1.0-beta4
Comment #3
inferno_msk commentedSame problem here
Comment #4
inferno_msk commentedeven for a second time can be used.
Comment #5
joachim commented> I'm using a content type A with a multivalue field collection field. The field collection has two taxonomy fields, the second one being limited by the values in the first one. I'm using entity reference to reference these fields.
You've lost me now.
Could someone export all the required components to reproduce this to a feature:
- holding content type
- field collection(s) and their fields
- referenced content types
Comment #6
miiimoooI'm not sure it can be done. But I remember following your example of countries and cities at first to get the hang of how it works. Now, instead of putting the Country and City field into the fields of a node type, add a new field collection items and importantly set it to cardinality "Unlimited". Then add the two fields to the field collection type and set the node limit reference options as you would for the fields of a node type.
Then on the node edit (or add) page you'll notice that the limiting doesn't work at all. Hope this helps. If you have faeture to start off from I'd give it a try.
Comment #7
joachim commented> I'm not sure it can be done.
I'm sure it can. Just put all the components you need into a Feature and upload the tarball here. That's far simpler than trying to follow instructions I don't fully understand.
Comment #8
miiimoooFirst try..
Comment #9
pmichelazzoI have the same error here:
Any clue?
Thank you
Comment #10
shomari commentedAny update. I've seen a few patches that remove the errors but the fields still do not work. The second field shows all values regardless of what is selected in the first field.
Comment #11
Mohannp commentedI am also having the same problem I implement this outside field collection it works fine but inside field collection it throws error like this :
Notice: Undefined index: und in reference_option_limit_form_alter() (line 417 of /home/mohan/project/drupal-7.22/sites/all/modules/reference_option_limit/reference_option_limit.module).
Notice: Undefined index: und in reference_option_limit_form_alter() (line 437 of /home/mohan/project/drupal-7.22/sites/all/modules/reference_option_limit/reference_option_limit.module).
Notice: Undefined index: #description in reference_option_limit_form_alter() (line 437 of /home/mohan/project/drupal-7.22/sites/all/modules/reference_option_limit/reference_option_limit.module).
Is there any suggestions that how to fix this or any patch available ?
Comment #12
ykyuen commentedthe root cause of the problem is becoz of the nestled hierarchy in field collection case. see if the following patch could fix it.
Comment #13
ykyuen commentedby the way, the patch could not help if u have a field collection inside a field collection.
Comment #14
Mohannp commentedThanks for the patch I applied it but the child select list is not able to populate in the field collection.
Comment #15
ykyuen commentedWhat is the structure of your content type? similar to the term reference examplein my blog.
Comment #16
Mohannp commentedYes, the content type is similar to the one that is in your blog. I applied your patch in the dev version of reference option module. It is fine outside the field collection but inside the field collection it cannot populate the second child list. By the way how did you achieve this inside field collection ?
Comment #17
ykyuen commentedi modified the code so that in will check whether the fields are inside the field collection. In my case, it works if both country and city are outside the field collection field as well as both inside the field collection field.
attached is my module folder for your reference.
Comment #18
joachim commentedThanks!
Though could you post that as a patch rather than a zipfile, so it's easy to see what's been changed?
Comment #19
Mohannp commented@ykyuen, I tried with the attached refernce option module that you provided but still my problem persists. It is not able to populate the second field inside field collection even though it made an ajax call. Since the error does not show up but no results in the child list. Yes it works fine outside the field collection.
Comment #20
Mohannp commentedI applied the patch that is available here at https://drupal.org/node/1649470#comment-6843032 . It worked fine if the field collection is only one but if the field collection is created with unlimited option then only for the first field collection reference it works but rest of the others the second child select list shows up all the options.
Comment #21
ykyuen commentedyes, multiple would not work in my modified version. so you got it working?
i think the the version i worked on is the dev version as i git clone the project from drupal.org.
Comment #22
lonehorseend commentedActually, gentlemen, this sounds similar to the problem that they have with conditional fields. You could always select the first one in a field collection, but when you got to the second or third, it failed. The patch for fixing that is at https://drupal.org/node/1464950, maybe the code can be looked at and adapted.
Comment #23
joachim commentedThis has probably been fixed as part of fixing for Profile2.
Comment #24
Arne Slabbinck commentedThis problem still persist for me. Using:
Field collection: 7.x-1.0-beta8
Profile2 : 7.x-1.3
Reference option limit: 7.x-1.6
Using a field collection of Main - and Subcategories, where the subcategories are limited to the chosen main category, in a profile2 setting. If only one field collection is visible, everything goes fine, but as soon as i add a second, all subcategories are shown for both field collections, regardles of main category. Changing main category doesn't trigger changement of subcategories anymore then.
Comment #25
cobaltje commentedI reopen this because this still isn't fixed.
I see that the maintainer closed it because it probblys is fixed in profile2.
I have the same issues that it isn't working with field collections and i don't even use profile2, so it has nothing to do with this problem.
Can you guys please check this problem again?
Comment #26
jomarocas commentedThe problem persist no working, and still have problems with field collection i dont install profile2
Comment #27
jomarocas commentedTesting all patch and no working that i expect but the case is the next, i put the field collection in node and the same referenced field that i have in other content type, i try with states and cities and when select and state in the field collection no appear in the next field that is city, appear later of title and appear the fields that will be appear in cities is something rarely, i still see new patch for this, i try without success