LimeSurvey issue tracker
Registration

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
05818Bug reports[All Projects] Otherpublic2012-02-14 01:202012-03-14 21:08
Reporteruser17990 
Assigned ToTMSWhite 
PrioritynormalSeveritymajor 
StatusclosedResolutionfixed 
Product Version1.92RC3 
Target Version1.92RC5Fixed in Version1.92RC5 
Summary05818: Values passed on the URL do not get saved when the questions are hidden
DescriptionWhen I pass values to the survey on the URL using the SGQA, the values I pass are stored to the database if the questions are not hidden. If the questions are hidden ("Always hide this question"), then the values passed are not saved to the database. The documentation seems to indicate that values passed to hidden questions should save to the database.
Additional InformationThe URL I am using on my dev server is
http://appsnew.smarttracks.net/limesurvey/index.php?sid=77956&lang=en&77956X3X9=100&77956X3X10=1&77956X3X11=3887744 [^]

Works like a champ when the questions are not hidden.
I will donate to the project if issue is resolved within 48 hrsNo
LimeSurvey build number OR git commit ID12204
BrowserFirefox and Chrome
Database & DB-VersionMySQL 5.0.90
Operating System (Server)FreeBSD 8.1
Webserver software & versionApache 2.2.21
PHP Version5.2.14
Attached Files? file icon limesurvey_survey_77956.lss [^] (54,852 bytes) 2012-02-16 18:18

- Relationships

-  Notes
User avatar (17467)
TMSWhite (reporter)
2012-02-16 17:46

I believe that when the values are passed via the URL, the are saved into the $_SESSION (memory), but not actually saved to the database until after you pass the page on which those hidden questions are present.

If you navigate far enough into the survey that you pass the page with your hidden questions, do you then see the URL parameters in the database?
(17470)
user17990
2012-02-16 17:53

The hidden questions are actually on the first page (first group) of the survey. When the questions are visible, they are the first thing you see when you enter the survey. It is after I complete the survey that I look in the database and all of the survey answers are there except the hidden questions. When they are visible, even if I don't touch them, they save to the database correctly.

I read somewhere that hidden fields are not actually built into the page displaying the survey which makes me wonder if they are not being posted when the survey submits.
User avatar (17472)
TMSWhite (reporter)
2012-02-16 18:00

Do you see <input type='hidden' id='SGQA'> fields created on the first page for your hidden variables? If not, then the hidden values would not be posted. However, that shouldn't matter, since the decision about what to save to the database isn't entirely based upon what is posted.

Please attach the .lss survey file (or that first page group) so we can test this.
(17475)
user17990
2012-02-16 18:19

I do not see hidden input fields for the hidden questions.
User avatar (17488)
TMSWhite (reporter)
2012-02-17 15:25

OK, there are couple of possible ways to deal with this:

(1) At survey launch, save all URL parameters to $_SESSION, and then only save the actual values to the database if the questions are relevant. The question is when to save to the database:
(a) Just before visiting the page on which they are declared (as default values are saved now)
(b) Save only after visiting the page on which they are declared (e.g. if press next, previous, or resume later).

(2) At survey launch, save all parameters passed via URL to the database (e.g. first ensuring that they are survey-specific variables with valid SGQA codes). But, should they be validated in any way first? Certainly, they should be processed to ensure that unsafe or data-type mismatched values aren't stored. However, in order to ensure that they pass relevance and validation criteria, you need to either
(a) wait until the page where there are declared (since validations occur there);
(b) validate the whole survey (which can take a couple of seconds); or
(c) do a loop to validate each question associated with the SGQA codes - but this isn't as thorough a validation since it is taking the questions out of the larger context.

Saving the URL parameters at the start ensures that you don't lose the context if the person stops mid-survey and wants to come back later (without using the full URL again).

However, saving all URL parameters at the start without strong validation runs the risk of having some invalid or irrelevant data saved early on. This will be cleaned up as the survey progresses, and the survey will be fully clean by the final submit. So, is having a partially inconsistent data row considered a problem?
User avatar (17489)
c_schmitz (administrator)
2012-02-17 15:31

Saving to the $_SESSION is fine as a first step - if the first values from a normal survey page are submittted/saved to the database the URL parameters should be saved to the database, too.

In the Yii version you will not be able to the old style SGQA in URL parameters anymore.

Instead you can create your own URL custom variable names and specify in which question they should be saved.
User avatar (17491)
TMSWhite (reporter)
2012-02-17 15:44

So, I'll implement option (2)(d) - put all URL parameters into $_SESSION, and save them to the database (after minimal validation), when the first page is visited.
User avatar (17499)
TMSWhite (reporter)
2012-02-17 21:30

Fixed in revision https://github.com/LimeSurvey/LimeSurvey/commit/2bcbd199bb74dc95e4a01209e72835b5dcd00169 [^]
User avatar (17657)
c_schmitz (administrator)
2012-02-26 14:21

1.92RC5 release

- Related Changesets
LimeSurvey: Yii 392ef9df
Timestamp: 2012-02-17 12:30:39
Author: TMSWhite
Committer: Thomas White
Details ] Diff ]
Fixed issue 05818: Values passed on the URL do not get saved when the questions are hidden
mod - application/helpers/expressions/em_manager_helper.php Diff ] File ]
mod - application/helpers/frontend_helper.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2012-02-14 01:20 user17990 New Issue
2012-02-16 17:46 TMSWhite Note Added: 17467
2012-02-16 17:53 user17990 Note Added: 17470
2012-02-16 18:00 TMSWhite Note Added: 17472
2012-02-16 18:18 user17990 File Added: limesurvey_survey_77956.lss
2012-02-16 18:19 user17990 Note Added: 17475
2012-02-17 15:25 TMSWhite Note Added: 17488
2012-02-17 15:31 c_schmitz Note Added: 17489
2012-02-17 15:44 TMSWhite Note Added: 17491
2012-02-17 18:44 TMSWhite Target Version => 1.92RC5
2012-02-17 21:30 TMSWhite Note Added: 17499
2012-02-17 21:30 TMSWhite Status new => resolved
2012-02-17 21:30 TMSWhite Fixed in Version => 1.92RC5
2012-02-17 21:30 TMSWhite Resolution open => fixed
2012-02-17 21:30 TMSWhite Assigned To => TMSWhite
2012-02-26 14:21 c_schmitz Note Added: 17657
2012-02-26 14:21 c_schmitz Status resolved => closed
2012-03-14 21:08 TMSWhite Changeset attached => Import 2012-03-09 13:30:34 Yii 392ef9df


Copyright © 2000 - 2014 MantisBT Team
Powered by Mantis Bugtracker