Hello,

I have a very simple registration form. Depending on a select list I have two other fields (one text and one list) that become visible. I get this notice on my pages:

Notice: Undefined offset: 0 in conditional_fields_states_handler_text() (line 1788 of site_name/sites/all/modules/conditional_fields/conditional_fields.module)

In the conditional_fields.module it states

/**
 * States handler for text fields.
 */
function conditional_fields_states_handler_text($field, $field_info, $options, &$state) {
  // Text fields values are keyed by cardinality, so we have to flatten them.
  // TODO: support multiple values.
  if ($options['values_set'] == CONDITIONAL_FIELDS_DEPENDENCY_VALUES_WIDGET) {
    // Cast as array to handle the exception of autocomplete text fields.
    $value = (array) $state[$options['state']][$options['selector']]['value'][0];
    $state[$options['state']][$options['selector']]['value'] = array_shift($value);
  }
}

Seems the issue is connected with dependent text field. Please advice if there is way to fix it.
I am using the latest dev. Also other similar issues I was able to find:
#1147206: Undefined offset:
#1535332: Undefined offset: 0 in conditional_fields_form_after_build() (line 562 of conditional_fields.module)
Thank you

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

esmitex’s picture

Issue summary: View changes

I have a similar issue:

Notice: Undefined offset: 0 in conditional_fields_states_handler_date_combo() (line 1815 of /homepages/5/d578771729/htdocs/smq/sites/all/modules/conditional_fields/conditional_fields.module).
Notice: Undefined offset: 0 in conditional_fields_states_handler_date_combo() (line 1820 of /homepages/5/d578771729/htdocs/smq/sites/all/modules/conditional_fields/conditional_fields.module).
sandipshirsale’s picture

Assigned: Unassigned » sandipshirsale
sandipshirsale’s picture

Assigned: sandipshirsale » Unassigned
Status: Active » Needs review
FileSize
2.86 KB

I have created patch, hope it will help you.

g33kg1rl’s picture

Worked for me. :)