Problem:

Notice: Undefined index: aslist in webform_select_options_ajax() (line 792 of webform/components/select.inc).

Reproduce:

  1. Create a new or edit an existing Select options component.
  2. Select a(nother) option in Load a pre-built option list
  3. You don't see any error, because Drupal doesn't show errors in Ajax responses well. But it's there. See watchdog.

Cause:

<?php
// $component doesn't exist here yet
$component['extra']['options_source'] = $source_name;
$options = _webform_select_options_to_text(_webform_select_options($component, !$component['extra']['aslist'], FALSE));
?>

So !$component['extra']['aslist'] is always TRUE.

CommentFileSizeAuthor
#2 webform-2369049-2.patch594 bytesrudiedirkx
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rudiedirkx’s picture

Issue summary: View changes
rudiedirkx’s picture

Status: Active » Needs review
FileSize
594 bytes

Very simple patch. One less notice.

rudiedirkx’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 2: webform-2369049-2.patch, failed testing.

DanChadwick’s picture

Status: Needs work » Closed (cannot reproduce)

Not sure what version you are using, but it isn't the latest 7.x-4.x-dev. Here is the code from there:

function webform_select_options_ajax($source_name = '') {
  $info = _webform_select_options_info();

  $component['extra']['options_source'] = $source_name;
  if ($source_name && isset($info[$source_name])) {
    $options = _webform_select_options_to_text(_webform_select_options($component, FALSE, FALSE));
  }
  else {
    $options = '';
  }

  $return = array(
    'elementId' => module_exists('options_element') ? 'edit-items-options-options-field-widget' : 'edit-extra-items',
    'options' => $options,
  );

  drupal_json_output($return);
}

Since this code doesn't reference 'aslist', I'm closing this an, I dunno, CNR(?). Please re-open if I am in error.

rudiedirkx’s picture

Yeah, it was 3.x which I had checked out for some reason... My bad. =) There's no Issue Status to describe this fail =)

rudiedirkx’s picture

Version: 7.x-4.x-dev » 7.x-3.x-dev
Status: Closed (cannot reproduce) » Closed (won't fix)

So I guess it's a Won't Fix for 3.x.