View Issue Details

IDProjectCategoryView StatusLast Update
17188Bug reportsExpression Managerpublic2021-04-22 16:16
Reporterzufolo441 Assigned Togabrieljenik  
PriorityhighSeveritypartial_block 
Status resolvedResolutionfixed 
Product Version4.4.13 
Summary17188: {GROUPNAME} and other variables not rendered
DescriptionHi,
I have some jQuery code in group description field.
some variables, like {GROUPNAME}, are not replaced anymore. in LS 2.x they work.

for example, the row:
  var idsala = '{GROUPNAME}'.split("_").pop();

in html page it is rendered:
  var idsala = ''.split("_").pop();

TagsNo tags attached.
Complete LimeSurvey version number (& build)4.4.13
I will donate to the project if issue is resolvedNo
BrowserFirefox 86
Database & DB-VersionPostgreSQL 11.9
Server OS (if known)BSD 12.2
Webserver software & version (if known)
PHP Version7.1.33

Relationships

related to 17204 resolvedgabrieljenik {GROUPNAME} and other variables not rendered 

Activities

ollehar

ollehar

2021-03-17 12:10

administrator   ~63399

Did they work in LS3 too? Can you give us a list of all variables that are broken?
zufolo441

zufolo441

2021-03-17 12:41

reporter   ~63400

we jumped from 2.64 to 4.4. :-)
GID too doesn't work, for example.
QID is working.
gabrieljenik

gabrieljenik

2021-03-22 18:43

manager   ~63562

Is there any variable being replaced on the scripts placed on the group description?
zufolo441

zufolo441

2021-03-22 20:50

reporter   ~63565

QID works.
gabrieljenik

gabrieljenik

2021-03-25 16:11

manager   ~63612

PR: https://github.com/LimeSurvey/LimeSurvey/pull/1815
I added it to dev as I think it could use some more testing time.

If goes OK, will work on the LS3 patch
DenisChenu

DenisChenu

2021-03-25 18:05

developer   ~63627

Where you have
for example, the row:
  var idsala = '{GROUPNAME}'.split("_").pop();

in html page it is rendered:
  var idsala = ''.split("_").pop();
 ??

Inside survey content ?

If it's twig file : you must use {{ processString("{GROUPNAME}"}}
gabrieljenik

gabrieljenik

2021-03-25 18:07

manager   ~63628

New PR: https://github.com/LimeSurvey/LimeSurvey/pull/1821
DenisChenu

DenisChenu

2021-03-25 18:11

developer   ~63629

I want deatils on this bug report

1. Other variables : what variables exactly ?
2. not replaced : when and how ?

Yes :there are difference between theme in 2.6 and 3.25 : API updated.
DenisChenu

DenisChenu

2021-03-26 09:30

developer   ~63645

Some test with 3.25.19

1. all in one : GID is replaced inside Group, not GROUPNAME
2. group by group : GID and GROUPNAME is replaced inside Group,

remind : inside group : GID and GROUPNAME must be set, outside group (header/ footer etc ) : GID and GROUPNAME must be empty.
limesurvey_survey_AlInOneGID.lss (14,253 bytes)   
<?xml version="1.0" encoding="UTF-8"?>
<document>
 <LimeSurveyDocType>Survey</LimeSurveyDocType>
 <DBVersion>365</DBVersion>
 <languages>
  <language>en</language>
 </languages>
 <groups>
  <fields>
   <fieldname>gid</fieldname>
   <fieldname>sid</fieldname>
   <fieldname>group_name</fieldname>
   <fieldname>group_order</fieldname>
   <fieldname>description</fieldname>
   <fieldname>language</fieldname>
   <fieldname>randomization_group</fieldname>
   <fieldname>grelevance</fieldname>
  </fields>
  <rows>
   <row>
    <gid><![CDATA[491]]></gid>
    <sid><![CDATA[977257]]></sid>
    <group_name><![CDATA[My first question group]]></group_name>
    <group_order><![CDATA[1]]></group_order>
    <description><![CDATA[SID : {SID}<br>
GID : {GID}<br>
QID : {QID}<br>
GROUPNAME : {GROUPNAME}<br>
]]></description>
    <language><![CDATA[en]]></language>
    <randomization_group/>
    <grelevance><![CDATA[1]]></grelevance>
   </row>
   <row>
    <gid><![CDATA[492]]></gid>
    <sid><![CDATA[977257]]></sid>
    <group_name><![CDATA[2nd]]></group_name>
    <group_order><![CDATA[2]]></group_order>
    <description><![CDATA[SID : {SID}<br>
GID : {GID}<br>
QID : {QID}<br>
GROUPNAME : {GROUPNAME}<br>
]]></description>
    <language><![CDATA[en]]></language>
    <randomization_group/>
    <grelevance/>
   </row>
  </rows>
 </groups>
 <questions>
  <fields>
   <fieldname>qid</fieldname>
   <fieldname>parent_qid</fieldname>
   <fieldname>sid</fieldname>
   <fieldname>gid</fieldname>
   <fieldname>type</fieldname>
   <fieldname>title</fieldname>
   <fieldname>question</fieldname>
   <fieldname>preg</fieldname>
   <fieldname>help</fieldname>
   <fieldname>other</fieldname>
   <fieldname>mandatory</fieldname>
   <fieldname>question_order</fieldname>
   <fieldname>language</fieldname>
   <fieldname>scale_id</fieldname>
   <fieldname>same_default</fieldname>
   <fieldname>relevance</fieldname>
   <fieldname>modulename</fieldname>
  </fields>
  <rows>
   <row>
    <qid><![CDATA[6457]]></qid>
    <parent_qid><![CDATA[0]]></parent_qid>
    <sid><![CDATA[977257]]></sid>
    <gid><![CDATA[491]]></gid>
    <type><![CDATA[T]]></type>
    <title><![CDATA[Q00]]></title>
    <question><![CDATA[SID : {SID}<br>
GID : {GID}<br>
QID : {QID}<br>
GROUPNAME : {GROUPNAME}<br>
]]></question>
    <preg/>
    <help/>
    <other><![CDATA[N]]></other>
    <mandatory><![CDATA[N]]></mandatory>
    <question_order><![CDATA[1]]></question_order>
    <language><![CDATA[en]]></language>
    <scale_id><![CDATA[0]]></scale_id>
    <same_default><![CDATA[0]]></same_default>
    <relevance><![CDATA[1]]></relevance>
    <modulename/>
   </row>
   <row>
    <qid><![CDATA[6458]]></qid>
    <parent_qid><![CDATA[0]]></parent_qid>
    <sid><![CDATA[977257]]></sid>
    <gid><![CDATA[492]]></gid>
    <type><![CDATA[T]]></type>
    <title><![CDATA[Q01]]></title>
    <question><![CDATA[SID : {SID}<br>
GID : {GID}<br>
QID : {QID}<br>
GROUPNAME : {GROUPNAME}<br>
]]></question>
    <preg/>
    <help/>
    <other><![CDATA[N]]></other>
    <mandatory><![CDATA[N]]></mandatory>
    <question_order><![CDATA[1]]></question_order>
    <language><![CDATA[en]]></language>
    <scale_id><![CDATA[0]]></scale_id>
    <same_default><![CDATA[0]]></same_default>
    <relevance><![CDATA[1]]></relevance>
   </row>
  </rows>
 </questions>
 <surveys>
  <fields>
   <fieldname>sid</fieldname>
   <fieldname>gsid</fieldname>
   <fieldname>admin</fieldname>
   <fieldname>expires</fieldname>
   <fieldname>startdate</fieldname>
   <fieldname>adminemail</fieldname>
   <fieldname>anonymized</fieldname>
   <fieldname>faxto</fieldname>
   <fieldname>format</fieldname>
   <fieldname>savetimings</fieldname>
   <fieldname>template</fieldname>
   <fieldname>language</fieldname>
   <fieldname>additional_languages</fieldname>
   <fieldname>datestamp</fieldname>
   <fieldname>usecookie</fieldname>
   <fieldname>allowregister</fieldname>
   <fieldname>allowsave</fieldname>
   <fieldname>autonumber_start</fieldname>
   <fieldname>autoredirect</fieldname>
   <fieldname>allowprev</fieldname>
   <fieldname>printanswers</fieldname>
   <fieldname>ipaddr</fieldname>
   <fieldname>refurl</fieldname>
   <fieldname>showsurveypolicynotice</fieldname>
   <fieldname>publicstatistics</fieldname>
   <fieldname>publicgraphs</fieldname>
   <fieldname>listpublic</fieldname>
   <fieldname>htmlemail</fieldname>
   <fieldname>sendconfirmation</fieldname>
   <fieldname>tokenanswerspersistence</fieldname>
   <fieldname>assessments</fieldname>
   <fieldname>usecaptcha</fieldname>
   <fieldname>usetokens</fieldname>
   <fieldname>bounce_email</fieldname>
   <fieldname>attributedescriptions</fieldname>
   <fieldname>emailresponseto</fieldname>
   <fieldname>emailnotificationto</fieldname>
   <fieldname>tokenlength</fieldname>
   <fieldname>showxquestions</fieldname>
   <fieldname>showgroupinfo</fieldname>
   <fieldname>shownoanswer</fieldname>
   <fieldname>showqnumcode</fieldname>
   <fieldname>bouncetime</fieldname>
   <fieldname>bounceprocessing</fieldname>
   <fieldname>bounceaccounttype</fieldname>
   <fieldname>bounceaccounthost</fieldname>
   <fieldname>bounceaccountpass</fieldname>
   <fieldname>bounceaccountencryption</fieldname>
   <fieldname>bounceaccountuser</fieldname>
   <fieldname>showwelcome</fieldname>
   <fieldname>showprogress</fieldname>
   <fieldname>questionindex</fieldname>
   <fieldname>navigationdelay</fieldname>
   <fieldname>nokeyboard</fieldname>
   <fieldname>alloweditaftercompletion</fieldname>
   <fieldname>googleanalyticsstyle</fieldname>
   <fieldname>googleanalyticsapikey</fieldname>
  </fields>
  <rows>
   <row>
    <sid><![CDATA[977257]]></sid>
    <gsid><![CDATA[1]]></gsid>
    <admin><![CDATA[Administrator]]></admin>
    <adminemail><![CDATA[contact@sondages.pro]]></adminemail>
    <anonymized><![CDATA[N]]></anonymized>
    <faxto/>
    <format><![CDATA[A]]></format>
    <savetimings><![CDATA[N]]></savetimings>
    <template><![CDATA[vanilla]]></template>
    <language><![CDATA[en]]></language>
    <additional_languages/>
    <datestamp><![CDATA[N]]></datestamp>
    <usecookie><![CDATA[N]]></usecookie>
    <allowregister><![CDATA[N]]></allowregister>
    <allowsave><![CDATA[Y]]></allowsave>
    <autonumber_start><![CDATA[0]]></autonumber_start>
    <autoredirect><![CDATA[N]]></autoredirect>
    <allowprev><![CDATA[N]]></allowprev>
    <printanswers><![CDATA[N]]></printanswers>
    <ipaddr><![CDATA[N]]></ipaddr>
    <refurl><![CDATA[N]]></refurl>
    <showsurveypolicynotice><![CDATA[0]]></showsurveypolicynotice>
    <publicstatistics><![CDATA[N]]></publicstatistics>
    <publicgraphs><![CDATA[N]]></publicgraphs>
    <listpublic><![CDATA[N]]></listpublic>
    <htmlemail><![CDATA[Y]]></htmlemail>
    <sendconfirmation><![CDATA[Y]]></sendconfirmation>
    <tokenanswerspersistence><![CDATA[N]]></tokenanswerspersistence>
    <assessments><![CDATA[N]]></assessments>
    <usecaptcha><![CDATA[N]]></usecaptcha>
    <usetokens><![CDATA[N]]></usetokens>
    <bounce_email><![CDATA[contact@sondages.pro]]></bounce_email>
    <emailresponseto/>
    <emailnotificationto/>
    <tokenlength><![CDATA[15]]></tokenlength>
    <showxquestions><![CDATA[Y]]></showxquestions>
    <showgroupinfo><![CDATA[B]]></showgroupinfo>
    <shownoanswer><![CDATA[N]]></shownoanswer>
    <showqnumcode><![CDATA[X]]></showqnumcode>
    <bounceprocessing><![CDATA[N]]></bounceprocessing>
    <showwelcome><![CDATA[Y]]></showwelcome>
    <showprogress><![CDATA[Y]]></showprogress>
    <questionindex><![CDATA[0]]></questionindex>
    <navigationdelay><![CDATA[0]]></navigationdelay>
    <nokeyboard><![CDATA[N]]></nokeyboard>
    <alloweditaftercompletion><![CDATA[N]]></alloweditaftercompletion>
   </row>
  </rows>
 </surveys>
 <surveys_languagesettings>
  <fields>
   <fieldname>surveyls_survey_id</fieldname>
   <fieldname>surveyls_language</fieldname>
   <fieldname>surveyls_title</fieldname>
   <fieldname>surveyls_description</fieldname>
   <fieldname>surveyls_welcometext</fieldname>
   <fieldname>surveyls_endtext</fieldname>
   <fieldname>surveyls_policy_notice</fieldname>
   <fieldname>surveyls_policy_error</fieldname>
   <fieldname>surveyls_policy_notice_label</fieldname>
   <fieldname>surveyls_url</fieldname>
   <fieldname>surveyls_urldescription</fieldname>
   <fieldname>surveyls_email_invite_subj</fieldname>
   <fieldname>surveyls_email_invite</fieldname>
   <fieldname>surveyls_email_remind_subj</fieldname>
   <fieldname>surveyls_email_remind</fieldname>
   <fieldname>surveyls_email_register_subj</fieldname>
   <fieldname>surveyls_email_register</fieldname>
   <fieldname>surveyls_email_confirm_subj</fieldname>
   <fieldname>surveyls_email_confirm</fieldname>
   <fieldname>surveyls_dateformat</fieldname>
   <fieldname>surveyls_attributecaptions</fieldname>
   <fieldname>email_admin_notification_subj</fieldname>
   <fieldname>email_admin_notification</fieldname>
   <fieldname>email_admin_responses_subj</fieldname>
   <fieldname>email_admin_responses</fieldname>
   <fieldname>surveyls_numberformat</fieldname>
   <fieldname>attachments</fieldname>
  </fields>
  <rows>
   <row>
    <surveyls_survey_id><![CDATA[977257]]></surveyls_survey_id>
    <surveyls_language><![CDATA[en]]></surveyls_language>
    <surveyls_title><![CDATA[Tes GID replacement]]></surveyls_title>
    <surveyls_description/>
    <surveyls_welcometext/>
    <surveyls_endtext/>
    <surveyls_url/>
    <surveyls_urldescription/>
    <surveyls_email_invite_subj><![CDATA[Invitation to participate in a survey]]></surveyls_email_invite_subj>
    <surveyls_email_invite><![CDATA[Dear {FIRSTNAME},<br />
<br />
you have been invited to participate in a survey.<br />
<br />
The survey is titled:<br />
"{SURVEYNAME}"<br />
<br />
"{SURVEYDESCRIPTION}"<br />
<br />
To participate, please click on the link below.<br />
<br />
Sincerely,<br />
<br />
{ADMINNAME} ({ADMINEMAIL})<br />
<br />
----------------------------------------------<br />
Click here to do the survey:<br />
{SURVEYURL}<br />
<br />
If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:<br />
{OPTOUTURL}<br />
<br />
If you are blacklisted but want to participate in this survey and want to receive invitations please click the following link:<br />
{OPTINURL}]]></surveyls_email_invite>
    <surveyls_email_remind_subj><![CDATA[Reminder to participate in a survey]]></surveyls_email_remind_subj>
    <surveyls_email_remind><![CDATA[Dear {FIRSTNAME},<br />
<br />
Recently we invited you to participate in a survey.<br />
<br />
We note that you have not yet completed the survey, and wish to remind you that the survey is still available should you wish to take part.<br />
<br />
The survey is titled:<br />
"{SURVEYNAME}"<br />
<br />
"{SURVEYDESCRIPTION}"<br />
<br />
To participate, please click on the link below.<br />
<br />
Sincerely,<br />
<br />
{ADMINNAME} ({ADMINEMAIL})<br />
<br />
----------------------------------------------<br />
Click here to do the survey:<br />
{SURVEYURL}<br />
<br />
If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:<br />
{OPTOUTURL}]]></surveyls_email_remind>
    <surveyls_email_register_subj><![CDATA[Survey registration confirmation]]></surveyls_email_register_subj>
    <surveyls_email_register><![CDATA[Dear {FIRSTNAME},<br />
<br />
You, or someone using your email address, have registered to participate in an online survey titled {SURVEYNAME}.<br />
<br />
To complete this survey, click on the following URL:<br />
<br />
{SURVEYURL}<br />
<br />
If you have any questions about this survey, or if you did not register to participate and believe this email is in error, please contact {ADMINNAME} at {ADMINEMAIL}.]]></surveyls_email_register>
    <surveyls_email_confirm_subj><![CDATA[Confirmation of your participation in our survey]]></surveyls_email_confirm_subj>
    <surveyls_email_confirm><![CDATA[Dear {FIRSTNAME},<br />
<br />
this email is to confirm that you have completed the survey titled {SURVEYNAME} and your response has been saved. Thank you for participating.<br />
<br />
If you have any further questions about this email, please contact {ADMINNAME} on {ADMINEMAIL}.<br />
<br />
Sincerely,<br />
<br />
{ADMINNAME}]]></surveyls_email_confirm>
    <surveyls_dateformat><![CDATA[1]]></surveyls_dateformat>
    <email_admin_notification_subj><![CDATA[Response submission for survey {SURVEYNAME}]]></email_admin_notification_subj>
    <email_admin_notification><![CDATA[Hello,<br />
<br />
A new response was submitted for your survey '{SURVEYNAME}'.<br />
<br />
Click the following link to see the individual response:<br />
{VIEWRESPONSEURL}<br />
<br />
Click the following link to edit the individual response:<br />
{EDITRESPONSEURL}<br />
<br />
View statistics by clicking here:<br />
{STATISTICSURL}]]></email_admin_notification>
    <email_admin_responses_subj><![CDATA[Response submission for survey {SURVEYNAME} with results]]></email_admin_responses_subj>
    <email_admin_responses><![CDATA[Hello,<br />
<br />
A new response was submitted for your survey '{SURVEYNAME}'.<br />
<br />
Click the following link to see the individual response:<br />
{VIEWRESPONSEURL}<br />
<br />
Click the following link to edit the individual response:<br />
{EDITRESPONSEURL}<br />
<br />
View statistics by clicking here:<br />
{STATISTICSURL}<br />
<br />
<br />
The following answers were given by the participant:<br />
{ANSWERTABLE}]]></email_admin_responses>
    <surveyls_numberformat><![CDATA[0]]></surveyls_numberformat>
   </row>
  </rows>
 </surveys_languagesettings>
 <themes>
  <theme>
   <sid>977257</sid>
   <template_name>vanilla</template_name>
   <config>
    <options>inherit</options>
   </config>
  </theme>
 </themes>
 <themes_inherited>
  <theme>
   <sid>977257</sid>
   <template_name>vanilla</template_name>
   <config>
    <options>
     <ajaxmode>off</ajaxmode>
     <brandlogo>on</brandlogo>
     <container>on</container>
     <hideprivacyinfo>off</hideprivacyinfo>
     <brandlogofile>./files/logo.png</brandlogofile>
     <font>noto</font>
    </options>
   </config>
  </theme>
 </themes_inherited>
</document>
DenisChenu

DenisChenu

2021-03-26 14:10

developer   ~63651

In 4.X :

1. All is OK in groupo by group mode
2. Must be fixed in All in one mode
3. Remind : before Group : it's not group (GID == GROUPNAME == NULL)
4. Remind : after Group : it's not group (GID == GROUPNAME == NULL)
DenisChenu

DenisChenu

2021-03-26 14:11

developer   ~63652

template used
extends_vanilla.zip (116,200 bytes)
zufolo441

zufolo441

2021-03-30 15:30

reporter   ~63721

2. I confirm the bug still persists in 4.4.15

thanks for these tests.
DenisChenu

DenisChenu

2021-04-05 15:11

developer   ~63799

Got a solution (in 3.X) for GROUPNAME
        <div class="{{ aSurveyInfo.class.groupdesc }} row well space-col" {{ aSurveyInfo.attr.groupdesc }}>
            {{ processString(
                aGroup.description,
                0,
                3,
                ({
                    'GROUPNAME' : aGroup.name,
                    'QID' : '',
                    'GID' : '',
                })
            ) }}
        </div>

No easy way to get GID but OK with GROUPNAME
https://github.com/LimeSurvey/LimeSurvey/blob/master/themes/survey/vanilla/views/subviews/survey/group_subviews/group_desc.twig
gabrieljenik

gabrieljenik

2021-04-07 18:03

manager   ~63858

Added a new commit to the PR as to deal with replacements on the group name
gabrieljenik

gabrieljenik

2021-04-09 09:29

manager   ~63887

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

Related Changesets

LimeSurvey: master 710cb43f

2021-04-09 09:29:00

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 17188: {GROUPNAME} and other variables not rendered (#1821) Affected Issues
17188
mod - application/helpers/SurveyRuntimeHelper.php Diff File

Issue History

Date Modified Username Field Change
2021-03-17 08:21 zufolo441 New Issue
2021-03-17 12:10 ollehar Note Added: 63399
2021-03-17 12:41 zufolo441 Note Added: 63400
2021-03-17 19:04 ollehar Priority none => high
2021-03-22 18:29 c_schmitz Assigned To => gabrieljenik
2021-03-22 18:29 c_schmitz Status new => assigned
2021-03-22 18:43 gabrieljenik Note Added: 63562
2021-03-22 20:50 zufolo441 Note Added: 63565
2021-03-25 16:11 gabrieljenik Note Added: 63612
2021-03-25 16:12 gabrieljenik Issue cloned: 17204
2021-03-25 16:12 gabrieljenik Relationship added related to 17204
2021-03-25 18:05 DenisChenu Note Added: 63627
2021-03-25 18:07 gabrieljenik Note Added: 63628
2021-03-25 18:11 DenisChenu Note Added: 63629
2021-03-26 09:30 DenisChenu Note Added: 63645
2021-03-26 09:30 DenisChenu File Added: limesurvey_survey_AlInOneGID.lss
2021-03-26 09:30 DenisChenu File Added: Capture d’écran_2021-03-26_09-28-32.png
2021-03-26 09:30 DenisChenu File Added: Capture d’écran_2021-03-26_09-30-32.png
2021-03-26 14:10 DenisChenu Note Added: 63651
2021-03-26 14:10 DenisChenu File Added: Capture d’écran_2021-03-26_14-08-44.png
2021-03-26 14:11 DenisChenu Note Added: 63652
2021-03-26 14:11 DenisChenu File Added: extends_vanilla.zip
2021-03-26 14:11 DenisChenu File Added: Capture d’écran_2021-03-26_14-10-50.png
2021-03-30 15:30 zufolo441 Note Added: 63721
2021-04-05 15:11 DenisChenu Note Added: 63799
2021-04-07 18:03 gabrieljenik Note Added: 63858
2021-04-09 09:29 gabrieljenik Changeset attached => LimeSurvey master 710cb43f
2021-04-09 09:29 gabrieljenik Note Added: 63887
2021-04-09 09:29 gabrieljenik Resolution open => fixed
2021-04-22 16:16 gabrieljenik Status assigned => resolved