View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
05818Bug reportsOtherpublic2012-03-14 21:08
Reporteruser17990Assigned ToTMSWhite  
PrioritynormalSeveritypartial_block 
Status closedResolutionfixed 
Product Version1.92RC3 
Target Version1.92RC5Fixed in Version1.92RC5 
Summary05818: Values passed on the URL do not get saved when the questions are hidden
Description

When 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 Information

The 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.

TagsNo tags attached.
Attached Files
Bug heat6
Complete LimeSurvey version number (& build)12204
I will donate to the project if issue is resolvedNo
BrowserFirefox and Chrome
Database type & versionMySQL 5.0.90
Server OS (if known)FreeBSD 8.1
Webserver software & version (if known)Apache 2.2.21
PHP Version5.2.14

Users monitoring this issue

There are no users monitoring this issue.

Activities

TMSWhite

TMSWhite

2012-02-16 17:46

reporter   ~17467

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?

user17990

2012-02-16 17:53

  ~17470

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.

TMSWhite

TMSWhite

2012-02-16 18:00

reporter   ~17472

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.

user17990

2012-02-16 18:19

  ~17475

I do not see hidden input fields for the hidden questions.

TMSWhite

TMSWhite

2012-02-17 15:25

reporter   ~17488

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?

c_schmitz

c_schmitz

2012-02-17 15:31

administrator   ~17489

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.

TMSWhite

TMSWhite

2012-02-17 15:44

reporter   ~17491

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.

TMSWhite

TMSWhite

2012-02-17 21:30

reporter   ~17499

Fixed in revision https://github.com/LimeSurvey/LimeSurvey/commit/2bcbd199bb74dc95e4a01209e72835b5dcd00169

c_schmitz

c_schmitz

2012-02-26 14:21

administrator   ~17657

1.92RC5 release

Related Changesets

LimeSurvey: Yii 392ef9df

2012-02-17 12:30:39

TMSWhite

Details Diff
Fixed issue 05818: Values passed on the URL do not get saved when the questions are hidden Affected Issues
05818
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