View Issue Details

IDProjectCategoryView StatusLast Update
12521Bug reports[All Projects] Expression Managerpublic2018-03-30 08:24
ReportersamsetAssigned To 
PrioritynoneSeverityminor 
Status confirmedResolutionopen 
Product Version2.67.x 
Target VersionFixed in Version 
Summary12521: Equation using .question suffix are not updated in javascript
Description

I have a simple equation which refer to a Array 10 point choice question in the same question group.

The following test output never changes what ever the value of CL02_SQ001.
Depending on the operator (< ou >) you will always get either BAD or the question label but the output will never switch from one value to the other.

{if(CL02_SQ001.value<7,CL02_SQ001.question,'BAD')}

I'm stuck.

Thank you for your help.

TagsNo tags attached.
Complete LimeSurvey version number (& build)online
I will donate to the project if issue is resolvedNo
Browser
Database & DB-Versiononline
Server OS (if known)online
Webserver software & version (if known)online
PHP Versiononline

Activities

DenisChenu

DenisChenu

2017-07-07 17:16

developer   ~44052

lss file with 2 question only please.

samset

samset

2017-07-07 17:44

reporter  

limesurvey_survey_189553.lss.xml (18,891 bytes)
samset

samset

2017-07-12 16:49

reporter   ~44080

Hi Denis,

I've sent the iss file. Any feedback ?
Thank you.

DenisChenu

DenisChenu

2017-07-12 16:59

developer  

limesurvey_survey_189553.lss (19,305 bytes)
DenisChenu

DenisChenu

2017-07-12 16:59

developer   ~44081

Can confirm the issue

See updated version :

DenisChenu

DenisChenu

2017-07-13 09:52

developer   ~44082

PS : if you use online version : you can open a ticket on https://www.limesurvey.org/support?view=ticket&amp;layout=open

DenisChenu

DenisChenu

2017-07-14 19:40

developer   ~44087

Last edited: 2017-07-14 19:41

View 2 revisions

Tested : issus is .question are not updated with javascript. More like a static var.
Issue exist in 2.6 too
The issue is here : https://github.com/LimeSurvey/LimeSurvey/blob/2.06lts/scripts/expressions/em_javascript.js#L615 attr.question is undefined.

3 solutions

  1. Show CODE.question as a static var em_static) : then it'rs more clear for admin user
  2. add .question in attr : but it can rellay broke page, make a bigger javasccript : i thinl it's the WORTS idea
  3. use a $("#ls-question-text-{SGQ}").html() system (see with core https://github.com/LimeSurvey/LimeSurvey/blob/7bf6bc9e6749623b0596146b7f2417525e1196a8/application/helpers/SurveyRuntimeHelper.php#L1283) . Then this id must come from core (not from template).


limesurvey_survey_questionNotUpdatedJS.lss (15,153 bytes)
samset

samset

2017-07-19 15:09

reporter   ~44113

I'm using the online version. I have created a ticket.
Is there a user level workaround for this issue ?

Thank you

DenisChenu

DenisChenu

2017-07-19 15:19

developer   ~44114

Except use "The question text" : currently : no

{if(CL02_SQ001.NAOK<7,"The text on CL02_SQ001 question",'BAD')}

samset

samset

2017-07-19 17:29

reporter   ~44117

Ok. Thank you.

samset

samset

2017-07-25 17:46

reporter   ~44238

Hi,

Have you escalate the issue to the limesurvey support team ?
It is really annoying not to be able to retrieve the question text in if() statement.

I have no news from the support.

Thank you

DenisChenu

DenisChenu

2017-07-25 18:05

developer   ~44239

I really think 2 is a bad idea.
3 is only for next version if we able.
1 : this don't fix your issue :/

samset

samset

2017-07-25 23:06

reporter   ~44241

Am i the only person using .question in equations ?

DenisChenu

DenisChenu

2017-07-26 07:51

developer   ~44242

I use it, but never in same page. PHP work (on another page)

samset

samset

2017-07-26 10:19

reporter   ~44244

You mean that if create a equation in an other page referencing a previous question text it will work ?
I'll try that.

Thank you

samset

samset

2017-07-26 12:33

reporter   ~44245

Hi Denis,

I've tried the workaround but it does not work either.
The evaluation of the if() statement is always false or true depending on the position of the .question statement.
Check the included test.



limesurvey_survey_189553.lss-2.xml (16,342 bytes)
DenisChenu

DenisChenu

2017-07-26 13:01

developer   ~44246

You still use .question in same page … i never say to move it …

See the updated title "Equation using .question suffix are not updated in javascript"

samset

samset

2017-07-26 13:08

reporter   ~44247

My mistake. I don't understand the meaning of 'same page'.

Issue History

Date Modified Username Field Change
2017-07-07 16:13 samset New Issue
2017-07-07 17:16 DenisChenu Note Added: 44052
2017-07-07 17:44 samset File Added: limesurvey_survey_189553.lss.xml
2017-07-12 16:49 samset Note Added: 44080
2017-07-12 16:59 DenisChenu File Added: limesurvey_survey_189553.lss
2017-07-12 16:59 DenisChenu Note Added: 44081
2017-07-13 09:49 DenisChenu Status new => confirmed
2017-07-13 09:52 DenisChenu Product Version => 2.67.x
2017-07-13 09:52 DenisChenu Note Added: 44082
2017-07-14 19:27 DenisChenu Summary if statement évaluation => Equation using .question suffix are not updated in javascript
2017-07-14 19:40 DenisChenu File Added: limesurvey_survey_questionNotUpdatedJS.lss
2017-07-14 19:40 DenisChenu Note Added: 44087
2017-07-14 19:41 DenisChenu Note Edited: 44087 View Revisions
2017-07-19 15:09 samset Note Added: 44113
2017-07-19 15:19 DenisChenu Note Added: 44114
2017-07-19 17:29 samset Note Added: 44117
2017-07-25 17:46 samset Note Added: 44238
2017-07-25 18:05 DenisChenu Note Added: 44239
2017-07-25 23:06 samset Note Added: 44241
2017-07-26 07:51 DenisChenu Note Added: 44242
2017-07-26 10:19 samset Note Added: 44244
2017-07-26 12:33 samset File Added: limesurvey_survey_189553.lss-2.xml
2017-07-26 12:33 samset Note Added: 44245
2017-07-26 13:01 DenisChenu Note Added: 44246
2017-07-26 13:08 samset Note Added: 44247
2018-03-30 08:24 DenisChenu Severity major => minor