Rev: 7.x-4.0-rc3+9-dev

I get the following error messages on submission

Notice: Undefined index: #webform_component in theme_webform_element() (line 3311 of C:\xampp\htdocs\testsite\sites\all\modules\webform\webform.module).
Notice: Undefined index: #webform_component in theme_webform_element() (line 3311 of C:\xampp\htdocs\testsite\sites\all\modules\webform\webform.module).

Comments

danchadwick’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: -webform, -line 3311, -3311

That line is:

    $type = ($element['#webform_component']['type'] == 'select' && isset($element['#type'])) ? $element['#type'] : $element['#webform_component']['type'];

I'm unaware how an $element would not have a #webform_component. I am wondering if your webform is damaged in some way. Can you do some debugging to figure out which component is causing the problem? You might then re-create that component to see if you still have an issue.

danchadwick’s picture

Title: Line 3311 of webform.module » Undefined index: #webform_component in theme_webform_element()
Issue tags: -7.x-4.0-rc3+9-dev
jgibso’s picture

Started my whole sight from scratch.
Installed webform 7.x-4.0-rc3

Webform modules installed:
- Webform Add More 7.x-1.1+0-dev
- Webform Matrix Component 7.x-3.4
- Webform Phone Number 7.x-1.18
- Webform Postal Code 7.x-1.0-beta3
- Webform Structured Text7.x-1.3

Got about 75% of my form done and then I started getting an error on line 3306 - yes I know, different line number. When the error started showing up I hadn't used anything that I hadn't already used in the first 74%.

Line 3306: $type = ($element['#webform_component']['type'] == 'select' && isset($element['#type'])) ? $element['#type'] : $element['#webform_component']['type'];

At this point I am going to disable all the webform addon modules and see if I can pinpoint the problem... However, the fact that it just started throwing the error 75% of the way through has be confused.

jgibso’s picture

Update.

With no additional webform modules turned on I was able to complete as much of my form as I could before I started to need the other webform modules (matrix, postal code, etc).

The first one I turned on was Webform Matrix (7.x-3.4).

I created 3 different matrices. On the forth one I started getting the error again.

The only thing really different about the forth matrix was that it was in a fieldset in a fieldset.

This is the error message:

Notice: Undefined index: #webform_component in theme_webform_element() (line 3306 of C:\xampp\htdocs\testsite\sites\all\modules\webform\webform.module).
Notice: Undefined index: #webform_component in theme_webform_element() (line 3306 of C:\xampp\htdocs\testsite\sites\all\modules\webform\webform.module).

I've noticed that it doesn't show up all the time only sometimes.
Ex: I'll click on Content then the edit button beside the webform. Sometime the Edit screen will come up fine, other times it will come up but with the error message across the top.

Thoughts?

jgibso’s picture

Tiny update:
Obviously have flushed the caches. Tried getting rid of the fieldset yet the error message still pops up from time to time.

Even tried deleting the last matrix created - still didn't help.

jgibso’s picture

May have found the pattern.

If I click on the link to the webform (Application Form) and then click on any other link (a more info page I created, or even an admin page) I get the error message.

danchadwick’s picture

Project: Webform » Webform Matrix Component
Version: 7.x-4.x-dev » 7.x-3.x-dev
Status: Postponed (maintainer needs more info) » Active

I'm moving this issue to the Webform Matrix Component issue queue. Others there may be able to help diagnose the incompatibility between it and webform.

jgibso’s picture

Any updates?

chetan-singhal’s picture

hi @jgibso
I am looking into this issue. update to you soon.

chetan-singhal’s picture

Assigned: jgibso » chetan-singhal
chetan-singhal’s picture

Status: Active » Closed (cannot reproduce)
jalite1991’s picture

I am have the same problem any news on this?

I too am using Webform Matrix, and it appeared randomly.

Valera Tumash’s picture

I am using 7.x-4.13 version and have the same issue. Not as easy to debug the problem as I initially thought, btw.

As I determined the issue appears when using date element in matrix component.

Here is a print_r of an object caused the issue: https://dl.dropboxusercontent.com/u/80475107/date_object.log

As it turned out from using debug_backtrace the issue starts in function theme_webform_matrix_table of webform_matrix_component\webform_matrix_component.module in the line 359:

$cols[] = drupal_render($element[$i][$j]);

It seems that for the date element drupal_render fire template_preprocess_webform_element() later on and can't find $element['#webform_component'] in order to determine a type of the element in /sites/all/modules/webform/webform.module:

// All elements using this for display only are given the "display" type.
  if (isset($element['#format']) && $element['#format'] == 'html') {
    $type = 'display';
  }
  else {
    $type = ($element['#webform_component']['type'] == 'select' && isset($element['#type'])) ? $element['#type'] : $element['#webform_component']['type'];
  }
funkeyrandy’s picture

is there a solution for this?

cebab54’s picture

Did this get solved, I am having the same problem now on a new Drupal installation 7.59 with latest module

Would appreciate an update or fix?