Hi
I have upgraded webform to the webform 7.x-4.0-alpha6 to resolve the issue related to conditional webform module.
This is working fine as I expected but with the following notice when the user selects the condition "NO" but the email is received what I expected
Notice: Undefined index: info in webform_tokens() (line 137 of /var/www/sites/all/modules/webform/webform.tokens.inc).
I have a conditional field:
Do you have a car? - if yes the user has to enter the name of the car and when submitted the email contains
DO you have car : yes
Name : Honda Civic
_______
For the same field -Do you have a care?- IF no -there is no need to enter the name as it is not displayed and when submitted the email contains : the below is what I am expecting and I receive the same .No issues but after submitting the form when it goes to "Thank You Page" on the top of this page there is a Undefined Index Notice
DO you have car : No
Name :
Please do the needful.
Comment | File | Size | Author |
---|---|---|---|
#17 | webform_token_missing-1800212.patch | 1.13 KB | quicksketch |
Comments
Comment #1
Akshita CreditAttribution: Akshita commentedCan anyone look into this issue please?
Comment #2
quicksketchI'm not sure what the cause of this issue is. It seems as though you may have some nested fields that are causing the issue with tokens. The key "info" missing isn't a hard-coded string on line 137, it looks like it's a variable. So I'm guessing you have a fieldset with a key of "info"... not entirely sure though. If the notice isn't causing any trouble, in the mean time you can surpress notices under the "Error Reporting" admin page by showing only Warnings and Errors.
To help with this problem, it would be beneficial if you could start with a brand new form with just a single file on it and see if it is reproducible. Right now it's hard to tell what the problem is if it's not something that I can reproduce.
Comment #3
nflowers1228 CreditAttribution: nflowers1228 commentedI'm having a similar problem and might be able to give more details to how it's happening for me.
I am using tokens in my Form settings to create the confirmation page. My form has many conditional fields which means that some fields are left blank unless they are relevant to the previous selection.
Example:
Option list "Is this an existing site" Options Yes/No
If No is selected, then "Existing Site URL" field does not display.
I put the the following token in the confirmation page which included the nesting of the Fieldsets (site_information is the fieldset):
[submission:values:site_information:existing_site_url]
When I submit it, I get the following error:
Notice: Undefined index: existing_site_url in webform_tokens() (line 137 of /data01/d7/dev.yalesites.yale.edu/sites/all/modules/contrib/webform/webform.tokens.inc).
I have several conditional fields that I want to display in the confirmation page. When I use just [submission:values] to display all values, they all show up in a big paragraph without any line breaks so each field is on a separate line.
Hope this provides more clarity.
Comment #4
Akshita CreditAttribution: Akshita commented#3
I am also having the same issue . But for now as suggested by #2 disabled the Notices on configuration page.-It is a work around for now.
Comment #5
quicksketchThanks @nflowers1228 for the information! So it sounds like the nesting isn't the problem, it's the hidden fields that are causing the notices. That seems like it should be relatively easy to fix.
Comment #6
masdzen CreditAttribution: masdzen commentedI had the same problem. and I removed the checkmark from the checkbox "extra private" in the webform field config and worked out!
Comment #7
chyatt CreditAttribution: chyatt commentedI have a similar problem. e.g.:
Notice: Undefined index: contact in webform_tokens() (line 137 of /var/www/html/mysite/sites/mysite/modules/webform/webform.tokens.inc).
... 10 more ....
Notice: Undefined index: project_request_details in webform_tokens() (line 137 of /var/www/html/mysite/sites/mysite/modules/webform/webform.tokens.inc).
Any of the tokens listed in the error message are not included in the text of the email that gets sent.
I noticed that the tokens listed in the error messages corresponded directly to tokens not selected in the "Included e-mail values" section on the "Edit e-mail settings" form. By selecting (and therefore enabling) those tokens, the errors were resolved and the email text now includes them.
Since the "Included e-mail values" section is collapsed by default, I wonder if this solution might work for those of you also seeing this?
Stupid question: Why do we even need that Included e-mail values" section?
C
Comment #8
TimG1 CreditAttribution: TimG1 commentedHi All,
I'm getting the same error. Here's my example.
[ ] Are you an alumni?
Graduation year ________
Name at graduation _______
"Graduation year" and "Name at graduation" only appear if "Are you an alumni" is checked using conditional webform fields.
I also have these fields emailed to a staff member using tokens.
Submission produces no errors if "Are you an alumni" is checked and graduation year/name are filled out. Email gets the submitted value fine.
If "Are you an alumni" is not checked I still get the email fine, but the following errors are produced.
If I remove the tokens from my email that gets sent (but keep the webform fields as is) the error messages go away if submit with "Are you an alumni" unchecked.
None of my fields have the [ ] private checkbox checked.
Drupal 7.17
Webform 7.x-4.0-alpha6
Webform Tokens 7.x-1.1
Token 7.x-1.4
Thanks for reading,
-Tim
Comment #9
romaingar CreditAttribution: romaingar commentedOk, i'have the same issue, BUT if i add a simple
dpm($display_element);
just before the foreach line 137 of \sites\all\modules\contrib\webform\webform.tokens.inc
the notice disapear....
the dsm is not displayed and the value of the fields as well...
it's very strange isn't it ?
Comment #10
John Pitcairn CreditAttribution: John Pitcairn commentedYep, getting this too on webforms upgraded from 3.x.
The field token that is throwing the error for me is [submissions:values:phone:nolabel]. The field is a simple mandatory text field, field key is correct, and the field is not private or hidden.
Comment #11
John Pitcairn CreditAttribution: John Pitcairn commentedInteresting. If I remove that token from the email body, and from the "included email values", and flush all caches, I still get the error.Argh. I was altering the wrong form.
Adding the required token to "included email values" has fixed it here.
Comment #12
hefterbrumi CreditAttribution: hefterbrumi commentedThe behavior of this error for me is like that:
If a field is hidden due to the condition (and obviously not filled in) then it throws the error. If its not hidden because of the condition but left empty or filled in, it wont throw any errors. I tried to play around with the settings with no avail.
Some of them are in a fieldset and some of that not.
I am using a custom template for email.
"Adding the required token to "included email values" has fixed it here" in the previous comment does not make any sense for me. Everything is ticked there for me.
Comment #13
jreashor CreditAttribution: jreashor commentedThis fixed the issue for me.
Comment #14
p_stampy CreditAttribution: p_stampy commentedThanks!
#13 worked for us too.
Comment #15
Roensby CreditAttribution: Roensby commentedThis issue is happening in 7.x-4.0-beta1 too
Using tokens on the confirmation page for conditional components that haven't been filled out by the user triggers the "Notice: Undefined index" error.
Comment #16
penone CreditAttribution: penone commentedCan someone tell me where to put #13?
Thanks.
Comment #17
quicksketchThanks for the suggestion @jreashor. I've revised slightly because just setting $display_element to FALSE could result in PHP notices later down in the same function. I've committed this patch which is nearly identical, but skips the remainder of the function if $display_element is empty.
A new release should be coming out tomorrow, this fix will be included.
Comment #19
fenstratNeeds to be ported to 8.x-4.x.
Comment #21
fenstratCommitted 3915d99 to 8.x-4.x.