View Issue Details

IDProjectCategoryView StatusLast Update
09125Development [All Projects] Survey takingpublic2015-08-21 15:51
ReporterHendrik Assigned ToDenisChenu  
PrioritynormalSeveritymajor 
Status closedResolutionfixed 
Product Version 
Target VersionFixed in Version2.06 
Summary09125: Hidden Fields Not recording default data if whole group is hidden
Description

Hidden fields are not recording generated default values.
This happens ONLY if ALL fields in a group are hidden. (so this happens only if the whole group is not shown).

As soon as one questions is made visible, all generated values are saved.

Steps To Reproduce
  • Create a survey that has only hidden fields in a group that are short free text
  • Set a default answer (in my case "{rand(1,8)}") for the hidden fields
  • Do the survey
    Result: the random values in the hidden fields are not saved
  • Make one or more fields in the group visible
    Result: all random values in the hidden fields are saved
TagsNo tags attached.

Activities

DenisChenu

DenisChenu

2014-07-04 08:22

developer   ~30268

Last edited: 2014-07-04 08:24

View 3 revisions

Oh yes, i think i have the same for 'hidden question with default value' but in question by question mode.

.....
And you have exactly:

  • hidden question are not saved BUT EM can use the value.
    ....
    PS: can you provide a little lss file : using EM with hidden but not saved question.
DenisChenu

DenisChenu

2014-07-04 15:10

developer   ~30271

PS2: you can use EM:

  • Add an Equation quetsion type with {QUESTIONCODE="Default value"} and hide it : it's OK.

Denis

DenisChenu

DenisChenu

2014-07-04 15:26

developer  

limesurvey_survey_defaulthiddennotsaved.lss (16,377 bytes)
c_schmitz

c_schmitz

2014-07-25 09:39

administrator   ~30351

I think documenting this behaviour should be enough. Fixing this would be very difficult.

DenisChenu

DenisChenu

2014-07-25 16:13

developer   ~30355

Take it for documentation, move it to devloppement after. I don't like the:

  • hidden question are not saved BUT EM can use the value.
DenisChenu

DenisChenu

2014-07-25 16:26

developer   ~30356

http://manual.limesurvey.org/QS:Defaults
and
http://manual.limesurvey.org/Expression_Manager#Caution_about_using_Assignment_Operator_.28.3D.29

DenisChenu

DenisChenu

2014-07-25 16:27

developer   ~30357

Reopen fo a "future" release, when we start to rework EM.

DenisChenu

DenisChenu

2014-07-31 10:12

developer   ~30382

Last edited: 2014-07-31 10:13

View 2 revisions

Looking at expression_manager file:
Line 6548
// Regardless of whether relevant or hidden, if there is a default value and $_SESSION[$LEM->sessid][$sgqa] is NULL, then use the default value in $_SESSION, but don't write to database
// Also, set this AFTER testing relevance

Then i think we must do something like this:
$sgqas = explode('|',$LEM->qid2code[$qid]);
foreach ($sgqas as $sgqa)
{
if (!is_null($LEM->knownVars[$sgqa]['default']) && !isset($_SESSION[$LEM->sessid][$sgqa])) {
// add support for replacements
$defaultVal = $LEM->ProcessString($LEM->knownVars[$sgqa]['default'], NULL, NULL, false, 1, 1, false, false, true);
$_SESSION[$LEM->sessid][$sgqa] = $defaultVal;
if($qrel && $grel)//
$LEM->updatedValues[$sgqa] = $defaultVal;
}
}

Or better

  • set default value for relevant question before relevance
  • set default value for unrelevant question after relevance
DenisChenu

DenisChenu

2015-01-06 16:26

developer   ~31433

Fix committed to 2.06 branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=14819

DenisChenu

DenisChenu

2015-01-06 16:27

developer  

survey_archive_687995.lsa (3,528 bytes)

Related Changesets

LimeSurvey: 2.06 80bacdc0

2015-01-06 15:26:18

DenisChenu

Details Diff
Fixed issue 09125: Hidden Fields Not recording default data if whole group is hidden
Dev: save value in DB if relevant
Dev: Set $_SESSION for actual page
Affected Issues
09125
mod - application/helpers/expressions/em_manager_helper.php Diff File

Issue History

Date Modified Username Field Change
2014-07-02 11:31 Hendrik New Issue
2014-07-04 08:22 DenisChenu Note Added: 30268
2014-07-04 08:23 DenisChenu Note Edited: 30268 View Revisions
2014-07-04 08:24 DenisChenu Note Edited: 30268 View Revisions
2014-07-04 15:10 DenisChenu Note Added: 30271
2014-07-04 15:25 DenisChenu Priority urgent => normal
2014-07-04 15:26 DenisChenu File Added: limesurvey_survey_defaulthiddennotsaved.lss
2014-07-25 09:39 c_schmitz Note Added: 30351
2014-07-25 16:12 DenisChenu Category Survey taking => Documentation
2014-07-25 16:12 DenisChenu Assigned To => DenisChenu
2014-07-25 16:12 DenisChenu Status new => assigned
2014-07-25 16:13 DenisChenu Note Added: 30355
2014-07-25 16:26 DenisChenu Note Added: 30356
2014-07-25 16:26 DenisChenu Status assigned => closed
2014-07-25 16:26 DenisChenu Resolution open => fixed
2014-07-25 16:26 DenisChenu Project Bug reports => Development
2014-07-25 16:26 DenisChenu Status closed => feedback
2014-07-25 16:26 DenisChenu Resolution fixed => reopened
2014-07-25 16:26 DenisChenu Status feedback => assigned
2014-07-25 16:26 DenisChenu Category Documentation => Survey taking
2014-07-25 16:26 DenisChenu Product Version 2.05+ =>
2014-07-25 16:27 DenisChenu Note Added: 30357
2014-07-31 10:12 DenisChenu Note Added: 30382
2014-07-31 10:13 DenisChenu Note Edited: 30382 View Revisions
2015-01-06 16:26 DenisChenu Changeset attached => LimeSurvey 2.06 80bacdc0
2015-01-06 16:26 DenisChenu Note Added: 31433
2015-01-06 16:27 DenisChenu File Added: survey_archive_687995.lsa
2015-01-06 16:28 DenisChenu Status assigned => resolved
2015-01-06 16:28 DenisChenu Fixed in Version => 2.06
2015-01-06 16:28 DenisChenu Resolution reopened => fixed
2015-08-21 15:51 c_schmitz Status resolved => closed