I have the following error when validating my form since my webform 3.16 updating :
Notice : Undefined index: #webform_component in theme_webform_display_select() (line 507 in /myserverpath/sites/all/modules/webform/components/select.inc).
I don't know what to modify with the variables.

Comments

Category:bug» support

Does this happen with new forms as well as with existing forms? And did you run update.php after you upgraded the module?

On a 3.16 release, I can't immediately reproduce the problem.

It happens with an old webform and I ran update.php when I upgraded.

The problem happens with a form used inside a ubercart checkout pane with the Ubercart Webform Checkout Pane module.

Thanks for the update. You didn't say if it happens exclusively when using Ubercart Checkout Pane. If so, we can mark this issue duplicate of the issue you created over there, #1463056: Undefined index: #webform_component in theme_webform_display_select().

I happens on none Ubercart sites as well. Error occurs when using a form that was built before the upgrade to 3.16, the upgrade is performed then this error shows.

I was able to get rid of the error by removing the Select Field from the form. Seemed to clear up the error message. But adding it back gives the same error.

Looks like #1463056: Undefined index: #webform_component in theme_webform_display_select() was fixed over there, but I don't know what that actual fix was.

re:#6
I've asked arski to explain the fix, if possible

You can always look up the commits ;)

Well, the issue was that my module was trying to display the value of the submitted field on the order view page and whenever the corresponding token was inserted. For that theme($field_element['#theme'], array('element' => $field_element)); was used, where $field_element = webform_component_invoke($field['type'], 'display', $field, $field_data); and $field comes from foreach ($node->webform['components'] as $field) {. It turned out though, that I also needed to set $field_element['#webform_component'] = $field;, otherwise I got the error above.

Hope this helps. See the last added line in http://drupalcode.org/project/uc_webform_pane.git/blobdiff/71dde53b413c6... and the code surrounding it for an example.

Title:error with select componentError with select component in UC Checkout Pane
Status:Active» Fixed

Great, thanks arski. I think we can mark this issue fixed then. Updating the title to reflect what was actually addressed.

Version:7.x-3.16» 7.x-3.17
Status:Fixed» Needs review

I am having this same error with the select component and am NOT using UC. I am using Webform 3.17, this was not an upgrade to 3.17. Reopening the issue.

@tkelliot: Can you provide steps to reproduce this problem? I've still never seen it personally.

I too have this issue running 3.17 with no UC... Is there a fix because I need the select boxes in my form.

@rampdog: if you can provide steps to reproduce this problem from clean installation of Drupal I'll look into it. I can't provide a fix if I can't see the problem.

----------------------------------------------------------------
Update:
I have just been doing some testing and the error has something to do with the link between the select option and the email settings.

If the E-mail subject in the Email header dewtails section has Component selected (and a select component is selected) the error message will appear.

If this is changed to custom and you write in your own email subject then it does not produce an error.

I hope this helps :)

----------------------------------------------------------------

I have just installed the webform module (latest release) and created a new webform. I am using ubercart on the website but the webform is simply a "Contact Us" form not linked to ubercart at all.

My drupal site is all up-to-date, ran the update scripts etc and still no fix.

any ideas?

thanks.

Title:Error with select component in UC Checkout PaneError with select component

Removing mention of ucwp from the title as it seems to be confusing people leading to the solved issue in there asking for a fix when they should be asking here.

Good luck o/

Title:Error with select componentUndefined index: #webform_component in select.inc
Status:Needs review» Postponed (maintainer needs more info)

@bootn made a pretty good start at documenting how to reproduce the problem, but I still haven't managed to reproduce it myself. If someone can please provide steps from the beginning, I'll look into the problem.

I'm able to cure this issue (and the fact that the email subject comes with only the first selected option of multi-select) by editing select.inc to change this:

function theme_webform_display_select($variables) {
  $element = $variables['element'];
  $component = $element['#webform_component'];

to this:

function theme_webform_display_select($variables) {
  $element = $variables['element'];
  if (isset($element['#webform_component'])) {
    $component = $element['#webform_component'];
  }
  else {
    $component['extra']['multiple'] = count($element['#value']) > 0 ? 1 : 0;
  }

When the email subject gets built our $variables array look like so:

[element] => Array
(
[#title] => myselect
[#weight] => 9
[#theme] => webform_display_select
[#theme_wrappers] => Array
(
)
[#format] => text
[#options] => Array
(
[0] => Nought
[1] => One
[2] => Two
[3] => Three
[4] => Four
)
[#value] => Array
(
[0] => 0
[1] => 1
[2] => 2
)
[#translatable] => Array
(
[0] => title
[1] => options
)
[#children] =>
)

I don't know that this fix is the fix because the internals of themeing is one of the things I don't grasp to tightly. Does the above make sense to anyone, or should I be directing my attention elsewhere?

Status:Postponed (maintainer needs more info)» Active

I received this error after I imported a web form node using node_export while running 6.x-3.18.

I see this with a Drupal 7.14 with webform 7.x-3.18 and Webform term options 1.1.

The steps to reproduce:
1. Create a webform with a 'select options' form component that gets its options from a taxonomy vocabulary. 2. On the Form settings tab an URL should be given for Redirection location.
3. Send the webform.
4. See this message:
Notice: Undefined index: #webform_component in theme_webform_display_select() (line 547 of xxxxxxx/sites/all/modules/webform/components/select.inc).

I'm not on a clean install, but almost. If this does not reproduce the error, I will send more details on the form.

Also, this might be a Webform term options issue.

StatusFileSize
new705 bytes

As the email is sent fine, the problem seems to be the notice itself.
So made a patch from #17.

Status:Active» Postponed (maintainer needs more info)

@czigor and @vernond: The approach in your patch is merely compensating for the problem, not finding the original source of it. We need to find out why #webform_component is not being set in the first place, rather than setting a default if it's missing.

As it is, this problem is still unreproduceable for me. Anyone that can provide steps from a clean install of Drupal, that would be appreciated.

@quicksketch - I could only reproduce the error when select component was used for email subject.

As far as I could figure at the time, the reason for #webform_component not being set was because the email subject line is being built via core, so the array was not fully Webform compliant when the select component theme function gets called.

[edit] - added missing words

Ah interesting, thanks that might help me reproduce it. Really we shouldn't be needing #webform_component at all in our theme functions, perhaps we can modify the code to work directly from the other available properties.

AFAIK we only make use of #webform_component in select component theme_webform_display_*, and that only because select may contain multiple values.

I get the same Notice when using Webform as contact us and select component as subject of form E-mail.

Works great (no Notice) using default subject or custom subject like: Contact Form %email[subject].

@gumbukie

Works great (no Notice) using default subject or custom subject like: Contact Form %email[subject].

Could you explain the above format?

Following you I used:

My form %machine_name_for_the_slect_field[key]

and as an email subject I got:

My form %machine_name_for_the_slect_field[key]

instead of:

My form subject (one that user chose).

And yes - there is no notice.

Category:support» bug

Let's just make this one the bug report. I've closed #1715616: Undefined index: #webform_component w theme_webform_display_select().

making #26 & #27 clear:

In E-mail header details section / E-mail subject:
1) If I use 'component' corresponding to a select list option as an email subject I get this notice.

2) But, when I use my own (custom) formatted like that:

%email[my_select_list_field_machine_name]

the notice won't show up.

my_select_list_field_machine_name is returning value of the selected option filed (not key), which in my case is ok.

same as #26 but on webform 7.4.0 alpha4

StatusFileSize
new17.05 KB

When I use Component as the subject and that component is a Select field, the error occurs.

When I use a Custom subject (like the image below), I do not generate any errors. The Custom subject is the value of the Select field of my Webform.

This is a screen capture of E-mail Settings for Webform

Status:Postponed (maintainer needs more info)» Active

@gumbukie
thanks for your comment. It saved me a lot of time.

I confirm gumbukie's comment above as a sure way to replicate and resolve the problem. Changing the issue status to Active.

I just ran into this issue as well. I will confirm that mine was also caused by choosing Component and then an item that is a select box to fill in my E-mail subject.

I'm also having this error.

In my case, I use the 7.x-3.18 version, and the error is in line 546 of select.inc file.

The webforms aren't sent to the recipient.

Any news?

Status:Active» Fixed

Thanks everyone for the updates in this issue. I've corrected this issue in both possible places, removing the use of $element['#webform_component'] in our theme function and providing the missing variable at the same time, so old implementations will start working and new implementations will deprecate the use of accessing the #webform_component property in theme functions.

I've committed this patch to all current versions of Webform 3.x and 4.x.

Status:Fixed» Closed (fixed)

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

I had the same error using 7.15 and webform 3.x

I used your solution ...custom subject like: Contact Form %email[subject]...
and notification went away. I like this solution with the token included. Thank you!

Version:7.x-3.17» 7.x-3.18
Assigned:Unassigned» Clauce
Status:Closed (fixed)» Active

Hello,
Still have the problem on a contact webform.
The custom subject of #29, instead of the component, did it for me too.

I created a simple webform with :

  • a text field (name);
  • a e-mail field ;
  • a subject select list;
  • a textarea (message).

I have webform validation running on it.
And I don't have this error on other of my website webforms where there isn't a select list.

Thanks for this great module !