I, i found an error 500 when create a new webform component. in dblog i found this:

"Notice: Undefined index: extra in webform_conditional_form_webform_component_edit_form_alter()"
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tedbow’s picture

I don't think this would Module cause the problem.

Please re-read instructions here: https://drupal.org/node/add/project-issue/webform_conditional

In addition to instructions there
Turn of this module and confirm the problem no longer happens

tedbow’s picture

Status: Active » Postponed (maintainer needs more info)

need answers to #1

COBadger’s picture

tedbow, I had the same error pop up - disabled webform_conditional and no longer got the error message

message is:

Notice: Undefined index: extra in webform_conditional_form_webform_component_edit_form_alter() (line 25 of /[path]/sites/all/modules/webform_conditional/webform_conditional.module).

also get:

Notice: Undefined index: value in _webform_conditional_get_all_components() (line 662 of /[path]/sites/all/modules/webform_conditional/webform_conditional.module).

I have webform 7.x-4.0-beta1 installed - not sure if that's helpful in chasing this down.

COBadger’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Needs review
FileSize
1.36 KB

Created patch webform_conditional_error_500-2058643-4.patch to correct error:

Notice: Undefined index: value in _webform_conditional_get_all_components() (line 662 of /[path]/sites/all/modules/webform_conditional/webform_conditional.module).

COBadger’s picture

FileSize
1.32 KB

Updated patch to remove a debugging line

emi_bcn’s picture

Hello there,
I can confirm error 500 exists due a PHP error on webform_conditional_form_webform_component_edit_form_alter function at file webform_conditional.module. It's because does not exists the value $form['conditional']['extra'] , nor none of its descendants, as needed by the declarations

// line 25
$form['conditional']['extra']['conditional_component']['#options'] = $form['conditional']['extra']['conditional_component']['#options'] + $triggerComponents;
$default_value = trim($form['conditional']['extra']['conditional_values']['#default_value']);

It might be because some modules incompatibilities.

jibran’s picture

I have the same issue on the site. Here is the patch for #6.

tylergbass’s picture

Implemented the patch from #7 on my dev machine and it resolved my issue when attempting to edit webform components. Thanks!

Using webform_component 7.x-1.0-beta2

Yoran Scholiers’s picture

I can confirm that patch #7 fixes the problem.
Using webform_component 7.x-1.0-beta2

AaronBauman’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev
Status: Needs review » Reviewed & tested by the community

Confirm #7 fixes the problem
defensive programming FTW

RTBC

emi_bcn’s picture

Issue summary: View changes

Well, somebody did some changes but they are not enough. This is my proposal at webform_conditional_form_webform_component_edit_form_alter (this works for me and does not throws any warning nor error):

      $form['conditional']['extra']['conditional_component']['#options'] =
         (
            is_array($form['conditional']) &&
            array_key_exists('extra', $form['conditional']) &&
            is_array($form['conditional']['extra']) &&
            array_key_exists('#options', $form['conditional']['extra']['conditional_component']) &&
            is_array($form['conditional']['extra']['conditional_component']['#options'])
         ) ?
            $form['conditional']['extra']['conditional_component']['#options'] + $triggerComponents :
            $triggerComponents;

      if(array_key_exists('extra', $form['conditional']) &&
         array_key_exists('conditional_values', $form['conditional']['extra']) &&
         array_key_exists('#default_value', $form['conditional']['extra']['conditional_values']))
      {  
        $default_value = trim($form['conditional']['extra']['conditional_values']['#default_value']);
      }
vulpcod3z’s picture

Well, somebody did some changes but they are not enough. This is my proposal at webform_conditional_form_webform_component_edit_form_alter (this works for me and does not throws any warning nor error):

      $form['conditional']['extra']['conditional_component']['#options'] =
         (
            is_array($form['conditional']) &&
            array_key_exists('extra', $form['conditional']) &&
            is_array($form['conditional']['extra']) &&
            array_key_exists('#options', $form['conditional']['extra']['conditional_component']) &&
            is_array($form['conditional']['extra']['conditional_component']['#options'])
         ) ?
            $form['conditional']['extra']['conditional_component']['#options'] + $triggerComponents :
            $triggerComponents;

      if(array_key_exists('extra', $form['conditional']) &&
         array_key_exists('conditional_values', $form['conditional']['extra']) &&
         array_key_exists('#default_value', $form['conditional']['extra']['conditional_values']))
      {  
        $default_value = trim($form['conditional']['extra']['conditional_values']['#default_value']);
      }

I can confirm this fix, Drupal v7.32 || Webform 7.x-4.12 || Webform conditional 7.x-1.0 (with function replacement)

ymeiner’s picture

created a patch from @emi_bcn comment. worked for me.

ymeiner’s picture

Or the file i really created.... sorry...

ymeiner’s picture

joelpittet’s picture

Status: Reviewed & tested by the community » Needs review

#7 was RTBC, nobody has tested the new code so setting to "needs review"

yang_yi_cn’s picture

Status: Needs review » Needs work

it now passes /node/***/webform/components/** (the component edit screen). However, when you save, it still throws warnings:

Notice: Undefined index: conditional_values in webform_condtional_component_edit_submit() (line 72... webform_conditional/webform_conditional.module)

Notice: Undefined index: conditional_values in webform_condtional_component_edit_submit() (line 73... webform_conditional/webform_conditional.module)

yang_yi_cn’s picture

Status: Needs work » Needs review
FileSize
2.67 KB

rolled another patch including the warning fixes (and including the old patch).

dsouchay’s picture

Another solutions for this error... worked for me.