View Issue Details

IDProjectCategoryView StatusLast Update
04927User patchesSurvey at runtimepublic2012-06-21 13:23
Assigned Tomdekker 
Status closedResolutionfixed 
Product Version1.90 
Target VersionFixed in Version1.91 
Summary04927: added SurveyGroupQuestion identifier as a variable for use in questions
Descriptionsometimes people use javascript in the question text field to do special things with a question. It is often necessary in this js to reference the input field element of the question, which has an html id in the format of AnswerSxGxQ. Instead of hard-coding the SxGxQ every time, this patch lets users simply use the template replacement marker of "{SGQ}" (without quotes) which will later get replaced with the actual SxGxQ before rendering in the survey.
Steps To ReproduceOnly four lines were added to the code in four separate files:

group.php (for displaying group by group surveys)

question.php (for displaying question by question surveys)

survey.php (for displaying all-in-one surveys)

common_functions.php (handles the actual replacement of text)
Additional InformationThis was based on the install files for 1.9.1 RC3 Build 9642. Nothing else was altered except for the files/lines mentioned in "Steps To Reproduce"

Available at:
TagsNo tags attached.
Complete LimeSurvey version number (& build)9642




2011-02-04 17:34

reporter   ~14053

Okay, I built a patch based on the latest SVN source (9742),
attached a a file here...


2011-02-04 17:35


diff.patch (1,333 bytes)
Common subdirectories: limesurvey_9742/admin and limesurvey-timbee/admin
Common subdirectories: limesurvey_9742/classes and limesurvey-timbee/classes
diff limesurvey_9742/common_functions.php limesurvey-timbee/common_functions.php
>     if (strpos($line, "{SGQ}") !== false) $line=str_replace("{SGQ}", $question['sgq'], $line);
Common subdirectories: limesurvey_9742/docs and limesurvey-timbee/docs
Common subdirectories: limesurvey_9742/fonts and limesurvey-timbee/fonts
diff limesurvey_9742/group.php limesurvey-timbee/group.php
>         $question['sgq']=$qa[7];
Common subdirectories: limesurvey_9742/images and limesurvey-timbee/images
Common subdirectories: limesurvey_9742/locale and limesurvey-timbee/locale
diff limesurvey_9742/question.php limesurvey-timbee/question.php
>             $question['sgq']=$qa[7];
Common subdirectories: limesurvey_9742/scripts and limesurvey-timbee/scripts
diff limesurvey_9742/survey.php limesurvey-timbee/survey.php
>                 $question['sgq']=$qa[7];
Common subdirectories: limesurvey_9742/.svn and limesurvey-timbee/.svn
Common subdirectories: limesurvey_9742/templates and limesurvey-timbee/templates
Common subdirectories: limesurvey_9742/tmp and limesurvey-timbee/tmp
Common subdirectories: limesurvey_9742/upload and limesurvey-timbee/upload
diff.patch (1,333 bytes)


2011-02-05 10:56

developer   ~14054

Thanks !

Not for 1.90, but maybe for 1.91 or 1.92.


2011-02-06 01:51

reporter   ~14056

groovy, thanks :)


2011-02-08 20:57

developer   ~14091

Menno, can you review the patch?


2011-02-09 19:59

developer   ~14119

Sure no problem


2011-02-09 20:38

developer   ~14120

Committed in svn 9755
Could you please add the documentation to our wiki?

perhaps with a link in the relevant work-around sections with the javascript?

Issue History

Date Modified Username Field Change
2011-02-03 17:31 timbee New Issue
2011-02-04 17:34 timbee Note Added: 14053
2011-02-04 17:35 timbee File Added: diff.patch
2011-02-05 10:56 DenisChenu Note Added: 14054
2011-02-06 01:51 timbee Note Added: 14056
2011-02-08 20:57 Mazi Assigned To => mdekker
2011-02-08 20:57 Mazi Status new => assigned
2011-02-08 20:57 Mazi Note Added: 14091
2011-02-09 19:59 mdekker Note Added: 14119
2011-02-09 20:38 mdekker Note Added: 14120
2011-02-09 20:38 mdekker Status assigned => resolved
2011-02-09 20:38 mdekker Fixed in Version => 1.91
2011-02-09 20:38 mdekker Resolution open => fixed
2012-06-21 13:23 c_schmitz Status resolved => closed