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.

Comments

miiimooo’s picture

Priority: Normal » Major

Bumping this

jhuon’s picture

Same problem here, using Reference option limit 7.x-1.1 with Field collection 7.x-1.0-beta4

inferno_msk’s picture

Same problem here

inferno_msk’s picture

even for a second time can be used.

joachim’s picture

Status: Active » Postponed (maintainer needs more info)

> 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

miiimooo’s picture

I'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.

joachim’s picture

> 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.

miiimooo’s picture

StatusFileSize
new11.87 KB

First try..

pmichelazzo’s picture

I have the same error here:

    Notice: Undefined index: #default_value em reference_option_limit_form_alter() (linha 317 de /Users/pmi/Sites/es/site/sites/all/modules/reference_option_limit/reference_option_limit.module).
    Notice: Undefined index: #default_value em reference_option_limit_form_alter() (linha 327 de /Users/pmi/Sites/es/site/sites/all/modules/reference_option_limit/reference_option_limit.module).
    Notice: Undefined index: und em reference_option_limit_form_alter() (linha 387 de /Users/pmi/Sites/es/site/sites/all/modules/reference_option_limit/reference_option_limit.module).
    Notice: Undefined index: und em reference_option_limit_form_alter() (linha 407 de /Users/pmi/Sites/es/site/sites/all/modules/reference_option_limit/reference_option_limit.module).
    Notice: Undefined index: #description em reference_option_limit_form_alter() (linha 407 de /Users/pmi/Sites/es/site/sites/all/modules/reference_option_limit/reference_option_limit.module).

Any clue?

Thank you

shomari’s picture

Any 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.

Mohannp’s picture

I 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 ?

ykyuen’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new42.36 KB

the root cause of the problem is becoz of the nestled hierarchy in field collection case. see if the following patch could fix it.

ykyuen’s picture

by the way, the patch could not help if u have a field collection inside a field collection.

Mohannp’s picture

Thanks for the patch I applied it but the child select list is not able to populate in the field collection.

ykyuen’s picture

What is the structure of your content type? similar to the term reference examplein my blog.

Mohannp’s picture

Yes, 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 ?

ykyuen’s picture

StatusFileSize
new27.14 KB

i 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.

joachim’s picture

Thanks!

Though could you post that as a patch rather than a zipfile, so it's easy to see what's been changed?

Mohannp’s picture

@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.

Mohannp’s picture

I 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.

ykyuen’s picture

yes, 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.

lonehorseend’s picture

Actually, 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.

joachim’s picture

Status: Needs review » Postponed (maintainer needs more info)

This has probably been fixed as part of fixing for Profile2.

Arne Slabbinck’s picture

This 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.

cobaltje’s picture

Status: Postponed (maintainer needs more info) » Active

I 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?

jomarocas’s picture

The problem persist no working, and still have problems with field collection i dont install profile2

jomarocas’s picture

Testing 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