Hi there,

I'm using Select (or other) with Profile2 module
and everytime a new user subscribes he gets the 'Undefined index" message below:

Notice: Undefined index: profile_journalist in select_or_other_field_widget_validate() (line 349 of /../../../../../sites/all/modules/select_or_other/select_or_other.field_widget.inc).

Great module!
Any help would be appreciated :)

Comments

danielb’s picture

danielb’s picture

Status: Active » Needs review

I've committed a change to this, will appear in next dev snapshot.

<?php

  // Add values to available options is configured to do so.
  if (!empty($form_state['field'][$field_name][$element['#parents'][1]]['instance'])) {
    $instance = $form_state['field'][$field_name][$element['#parents'][1]]['instance'];
  }
  else {
    $instance = field_widget_instance($element, $form_state);
  }

?>
danielb’s picture

I think there might be a better way to go about it.
The problem with the code is that it is assumed that


  $field_name = $element['#parents'][0];

and that the other thingo (language?) is at $element['#parents'][1]

but of course it doesn't have to be

Ideally it would just be $instance = field_widget_instance($element, $form_state); but that seems to fail with 'drag and drop lists' widget, as per the other issue.

Suggestions welcome

danielb’s picture

Title: Undefined index: profile_journalist in select_or_other_field_widget_validate() » Undefined index in select_or_other_field_widget_validate()
rich.3po’s picture

I just updated to the dev release, which includes the patch in #2. This fixed the issue i was having with commerce_custom_line_items (see http://drupal.org/node/1632256)

Thanks

danielb’s picture

Status: Needs review » Fixed

great thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit b3071dc on 7.x-2.x, 7.x-3.x, 8.x-3.x by danielb:
    Issue #1619670 by danielb: Undefined index in...