I have a content type "Event" that has 2 Entity Reference Fields "Venue" and "Room".
I have 2 Taxonomy Vocabularies "Venue" and "Room".
I have added the field "Venue" to the Taxonomy "Room".
For each "Room" term I have selected the "Venue" that the room belongs to.

Everything works as expected - that is, when creating an "Event" I can choose a "Venue" and the select list for "Room" is populated with the correct terms and I am able to save the "Event".

Whenever I create or edit an Event I get:

Notice: Undefined index: field_venue in reference_option_limit_form_alter() (line 338 of /myhome/myserver/public_html/mydrupalsite/sites/all/modules/reference_option_limit/reference_option_limit.module).
Warning: Invalid argument supplied for foreach() in reference_option_limit_form_alter() (line 338 of /myhome/myserver/public_html/mydrupalsite/sites/all/modules/reference_option_limit/reference_option_limit.module).
Notice: Undefined index: field_venue in reference_option_limit_form_alter() (line 380 of /myhome/myserver/public_html/mydrupalsite/sites/all/modules/reference_option_limit/reference_option_limit.module).

When examining the lines that are throwing the error I find:

// Build an array of field values to match on. This is keyed first by
// field name, and then by delta (or with default values, whatever).
// First time around these are in default values; in ajax calls these are in $form_state.
if (isset($form_state['values'])) {
// @todo: Figure out what on earth should happen when we have more than one column!
$column = $match_columns[$field_name_matching][0];
foreach ($form_state['values'][$field_name_matching][LANGUAGE_NONE] as $delta => $item)

338- $match_values[$field_name_matching][$delta] = $item[$column];

and

// Limit for the matching field values.
foreach ($settings['fields_match'] as $field_name_matching) {
// @todo: handle more than one column to match on.
$column = $match_columns[$field_name_matching][0];

380 - $values = $match_values[$field_name_matching];

// We currently treat multiple values on one field as an OR condition,
// i.e., we limit by any of the values but not all of them.
// @todo: Add a UI option to make this an AND condition.
if (empty($values) && ($settings['empty_behaviour'])) {
$values = array(0);
}
if (!empty($values)) {
$query->fieldCondition($field_name_matching, $column, $values, 'IN');
}
}

So this is working as expected however the error is distressing and I cant see what I'm doing wrong. Any help would be appreciated.

Comments

Aksharpanziar’s picture

Issue summary: View changes
Aksharpanziar’s picture

Issue summary: View changes
joachim’s picture

What is in $form_state['values'] at that point?

It's weird that you're getting this error, as you have what sounds like a completely standard setup for this.

I'm wondering whether you have any other modules that may change the form structure in some way.