Grid component adds non-safe data to database
clancy - July 21, 2008 - 23:36
| Project: | Webform |
| Version: | 6.x-2.1.3 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Jorrit |
| Status: | closed |
Description
If a grid is set up with options that have safe labels (i.e. "no|No thank you!") the non-safe portion is inserted into the database (the "No thank you!") This means that the analysis and view submissions do not work for grids. I was able to fix this by commenting out the entire _webform_submit_grid function in grid.inc. Why does this function do that? it seems to break the functionality. Shouldn't the safe values always be stored in the DB?

#1
BTW, this is similar to the problem with the select values being stored wrong that was fixed in 2.1.2.
#2
Crap. I'll try to take a look.
#3
The same fix applied to the select component cleared up the Grid component also. I've committed the fix to CVS.
http://cvs.drupal.org/viewcvs/drupal/contributions/modules/webform/compo...
#4
Automatically closed -- issue fixed for two weeks with no activity.
#5
Um, this is now worse (at least on mine) after upgrading to 2.1.3 it doesn't store ANY of the grid data. Just empty. What happened?
#6
I confirm, on my install, 6.x-2.1.3 broke the grid. Can't see data anywhere.
#7
The patch by quicksketch changed the array key from options to items, which is wrong. The attached patch fixes this.
#8
Thanks again Jorrit. I don't know how I missed this in testing. :/
I committed the fix and I'll get out (yet another) release to fix this problem.
#9
The patched worked well on a 6.4 site with webform 6.x-2.1.3.
#10
I can also confirm that this patch fixed the problem. Thanks for a great module!
#11
And to confirm that the webform 6.x-2.x-dev update 8/23/08 fix works beautifully(scroll down 60%) as well; Thanks Quicksketch and everyone who addressed the GRID issue!!
#12
Hi quicksketch, Jorrit & all,
Sorry to announce you that AGAIN we have the same bug but this time in a different way!!!
Indeed the "patch" worked great & the 6.x.2.x-dev fixed it but, all this time you were all (or this is what i think) trying the Grid without selecting both checkboxes for:
-Randomize Options
-Randomize Questions
Am i right or am missing something here?
I have tried under drupal 6.4 project and it works fine without selecting those checkboxes but sending EMPTY again (w/o storing any data) when selected!!!
What is going on with this BIG BUG?
Hope you find a solution soon, please.
Good luck & waiting for a new posts soon commenting what happens to all of you with this new bug!
#13
I can confirm the behavior that errement sees in #12 - if I create a grid and randomize both questions and options then the data seems to get lost.
However, with this patch applied if I just randomize the questions and not the options then the data is saved fine.
#14
Thank you greggles for responding!!
I tried what you said:
-Randomize Questions: work fine, as you said :-))
-Randomize Options: I get "0" (zeros) ONLY if selecting first options (if you select the first option for each question), but blank if you select other options than the first!!! :-O
-Randomize both Options & Questions = BLANK :-(
Hope we find a solution soon ;-)
#15
Again & after TODAY's announcement of a new webform 6.x-2.x-dev version, i installed it and confirm that we are still having the same problem!!
Anybody tried it?
As quicksketch says under the release notes:
#16
Thank you, thank you, thank you. I was suffering from grid results not being stored.
This patch fixed it for me on version 5.x-2.1.3 of Webform.
I'm happy. :-)
#17
@rattryde, which patch are you talking about?
The one on #7 or the link i gave on #15? cos i don't see how something made for D6 could fix a problem under D5?!
I use the latest release under D6.4 and grid results are not stored "only" if you use:
-Randomize Options
Other ways, are stored nicely.
Explain please, maybe you wanted to say:
Even so i don't know why doesn't it work for me? Anybody tried latest release?
#18
The patch in #7
Unless I'm mistaken this patch was created for D6 and my instance is definitely D5 but I thought I'd give it a go anyway.
So for sure I didn't mean to say version 6.x-2.1.3 of Webform, I definitely meant version 5.x-2.1.3
I can confirm it 100% works for me. However I should make it clear that I am not using the randomize functions at all (I have no need to, my problem was that v 5.x-2.1.3 of Webform was not populating the results of the grids at all regardless of whether or not the randomize options were selected, hence why I tried the above patch despite it not being made for D5). I could test to see if using randomize prevents the grids from working properly again if you like?
#19
Just tested it and using the randomize buttons does prevent the grid recording results properly. Luckily for me I don't need to use this function.
#20
@rattryde,
Thanq for responding, explanation, and very happy for you that it works like you need it to ;-)
Also appreciate your intention testing it for me.
I'd like to use the "Randomize Options" but for now is not possible until hopefully quicksketch find a solution for it. Other functions works perfectly —or as i know— for me.
I like very much the module and am using it specially for my Educational exams & tests —for my students—.
#21
Thanks everyone for the continued reports. I've looked into this further and it seems that the logic had mistakenly believed that the PHP function shuffle maintained the array keys (it does not). I'm a little surprised this worked before, as I'm not sure how we were maintaining integrity when the keys were being lost.
Regardless, this patch fixes the problem and I've committed it. I've written up a test suite to ensure this data corruption comes to an end. I'll release a 2.2 version with the fixes shortly.
#22
@quicksketch,
Thanq so so much for your patch.
I confirm that problems i mentioned here before are ALL SOLVED, it works great again!! FIXED, thx to you!!
Thanq.
;-))
Great module!!
temp
Automatically closed -- issue fixed for two weeks with no activity.
#23
Automatically closed -- issue fixed for two weeks with no activity.
#24
I'm moving this back into "fixed" until I get out a new release.
#25
Automatically closed -- issue fixed for two weeks with no activity.
#26
I just downloaded some data from a webform made in 8/2008 and the grid items aren't in the csv output. Does this mean that for sure the data simply doesn't exist (i.e., wasn't recorded or was destroyed in transit), or is there a chance that it's still stored in some form in the database but it will have to be extracted in some other way? If the latter is possible, can anyone provide suggestions for ways to tell if it's there, or how to extract it if it is?
Thanks for your help. The data is quite important, so any assistance would be greatly appreciated (and of course we're all kicking ourselves for not having kept a closer eye on it).