Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#31 | edit-e-mail-settings.png | 17.05 KB | gumbukie |
#21 | webform_component_notice-1462986-21.patch | 705 bytes | czigor |
Comments
Comment #1
quicksketchDoes 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.
Comment #2
christelle41 CreditAttribution: christelle41 commentedIt happens with an old webform and I ran update.php when I upgraded.
Comment #3
christelle41 CreditAttribution: christelle41 commentedThe problem happens with a form used inside a ubercart checkout pane with the Ubercart Webform Checkout Pane module.
Comment #4
quicksketchThanks 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().
Comment #5
whthat CreditAttribution: whthat commentedI 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.
Comment #6
quicksketchLooks 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.
Comment #7
carl.ben CreditAttribution: carl.ben commentedre:#6
I've asked arski to explain the fix, if possible
Comment #8
arski CreditAttribution: arski commentedYou 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 fromforeach ($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.
Comment #9
quicksketchGreat, thanks arski. I think we can mark this issue fixed then. Updating the title to reflect what was actually addressed.
Comment #10
tkelliot CreditAttribution: tkelliot commentedI 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.
Comment #11
quicksketch@tkelliot: Can you provide steps to reproduce this problem? I've still never seen it personally.
Comment #12
rampdog CreditAttribution: rampdog commentedI too have this issue running 3.17 with no UC... Is there a fix because I need the select boxes in my form.
Comment #13
quicksketch@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.
Comment #14
bootn CreditAttribution: bootn commented----------------------------------------------------------------
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.
Comment #15
arski CreditAttribution: arski commentedRemoving 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/
Comment #16
quicksketch@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.
Comment #17
vernond CreditAttribution: vernond commentedI'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:
to this:
When the email subject gets built our $variables array look like so:
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?
Comment #18
vernond CreditAttribution: vernond commentedComment #19
Jorrit CreditAttribution: Jorrit commentedI received this error after I imported a web form node using node_export while running 6.x-3.18.
Comment #20
czigor CreditAttribution: czigor commentedI 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.
Comment #21
czigor CreditAttribution: czigor commentedAs the email is sent fine, the problem seems to be the notice itself.
So made a patch from #17.
Comment #22
quicksketch@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.
Comment #23
vernond CreditAttribution: vernond commented@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
Comment #24
quicksketchAh 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.
Comment #25
vernond CreditAttribution: vernond commentedAFAIK we only make use of
#webform_component
in select componenttheme_webform_display_*
, and that only because select may contain multiple values.Comment #26
gumbukie CreditAttribution: gumbukie commentedI 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].
Comment #27
henry97 CreditAttribution: henry97 commented@gumbukie
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.
Comment #28
quicksketchLet's just make this one the bug report. I've closed #1715616: Undefined index: #webform_component w theme_webform_display_select().
Comment #29
henry97 CreditAttribution: henry97 commentedmaking #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.
Comment #30
FAAREIA CreditAttribution: FAAREIA commentedsame as #26 but on webform 7.4.0 alpha4
Comment #31
gumbukie CreditAttribution: gumbukie commentedWhen 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.
Comment #32
krishworks CreditAttribution: krishworks commented@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.
Comment #33
nitrospectide CreditAttribution: nitrospectide commentedI 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.
Comment #34
astutonetI'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?
Comment #35
quicksketchThanks 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.
Comment #37
owenpaula CreditAttribution: owenpaula commentedI 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!
Comment #38
Clauce CreditAttribution: Clauce commentedHello,
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 :
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 !
Comment #39
DanChadwick CreditAttribution: DanChadwick commentedNo longer fixing non-critical bugs in -3.x. Please re-open if this can be reproduced in 7.x-4.x.