View Issue Details

IDProjectCategoryView StatusLast Update
16610Bug reports_ Unknownpublic2021-03-15 15:37
Reportermikeinpdx Assigned Toollehar  
PrioritynormalSeverityblock 
Status closedResolutionfixed 
Product Version4.3.12 
Summary16610: Conditionals with Array Dual Scale not working
DescriptionIt appears that conditionals are not working correctly when using array dual scale. In this example survey, selecting "A" for scale1 and "D" for scale2 should enable the second question, but they don't. This same survey worked in an earlier release ( see video https://drive.google.com/file/d/1R4NXkLBkyogxuDLySZkEN9IX42uf4cat/view?usp=sharing).
Steps To Reproduceselecting "A" for scale1 and "D" for scale2 should enable the second question
Additional InformationNote - I selected "yes" for the donation promise since I donate through the Comfort Update subscription
LimeSurvey version
4.3.12
LimeSurvey build
200820
Operating system
Linux ubuntu-s-1vcpu-2gb-sfo2-01 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64
PHP version
7.2.33-1+ubuntu18.04.1+deb.sury.org+1
Web server name
requirementsondemand.com
Web server software
Apache/2.4.29 (Ubuntu)
Web server info
Apache/2.4.29 (Ubuntu) Server at requirementsondemand.com Port 443
Database driver
mysql
Database driver version
mysqlnd 5.0.12-dev - 20150407 - $Id: 3591daad22de08524295e1bd073aceeff11e6579 $
Database server info
Uptime: 249270 Threads: 1 Questions: 352054 Slow queries: 0 Opens: 204 Flush tables: 1 Open tables: 184 Queries per second avg: 1.412
Database server version
5.5.5-10.1.44-MariaDB-0ubuntu0.18.04.1
TagsNo tags attached.
Complete LimeSurvey version number (& build)Version 4.3.12+200820
I will donate to the project if issue is resolvedYes
BrowserChrome
Database & DB-Version5.5.5-10.1.44-MariaDB-0ubuntu0.18.04.1
Server OS (if known)
Webserver software & version (if known)
PHP Version7.2.33-1+ubuntu18.04.1+deb.sury.org+1

Relationships

related to 17160 closedc_schmitz Unable to edit condition 
related to 17174 new Array dual scale lose selected value when come back to same page 

Activities

mikeinpdx

mikeinpdx

2020-08-22 23:04

reporter  

ollehar

ollehar

2021-03-03 14:46

administrator   ~62651

Please check if this bug still exists in the latest patch release. Thank you.
DenisChenu

DenisChenu

2021-03-03 15:01

developer   ~62660

Same issue for me

Related to condition ? Number compare ? or double scale ?
DenisChenu

DenisChenu

2021-03-03 15:16

developer   ~62663

Update survey {Q1_SQ001_0.NAOK } is not updated via javascript
DenisChenu

DenisChenu

2021-03-03 15:17

developer   ~62664

And the proof
Peek 03-03-2021 15-17.gif (277,968 bytes)
ollehar

ollehar

2021-03-09 14:14

administrator   ~62932

Hm, should not be set to "feedback"...
ollehar

ollehar

2021-03-09 14:23

administrator   ~62933

Last edited: 2021-03-09 14:23

View 2 revisions

Is this broken on LS3 too? Can't import the LS4 survey there. -.-
ollehar

ollehar

2021-03-09 14:54

administrator   ~62934

The HTML didn't change much since 2018-05-08, so I guess the error must be somewhere else.
ollehar

ollehar

2021-03-09 15:03

administrator   ~62935

LS3 survey with same problem.
DenisChenu

DenisChenu

2021-03-09 15:03

developer   ~62936

> The HTML didn't change much since 2018-05-08, so I guess the error must be somewhere else.

It work in 3LTS
ollehar

ollehar

2021-03-09 15:05

administrator   ~62937

> It work in 3LTS

Yeah, but it was already converted to Twig in LS3.
DenisChenu

DenisChenu

2021-03-09 15:06

developer   ~62938

> LS3 survey with same problem.

Not for me (with gif)
Peek 09-03-2021 15-05.gif (91,416 bytes)   
Peek 09-03-2021 15-05.gif (91,416 bytes)   
ollehar

ollehar

2021-03-09 15:06

administrator   ~62939

Diff between LS3 and LS4 HTML is trivial:

< <col class="dsheader" />
---
> <col class="dsheader" style='width: {{ cellwidth }}%;' />
21c21
< <col class="dsheader" />
---
> <col class="dsheader" style='width: {{ cellwidth }}%;' />
28c28
< <th class='left-header'>{{ processString(leftheader) }}</th>
---
> <th class='left-header'>{{ leftheader }}</th>
30c30
< <th class='right-header'>{{ processString(rightheader) }}</th>
---
> <th class='right-header'>{{ rightheader }}</th>
46c46
< {{ processString(ansrow.question) }}
---
> {{ ansrow.question }}
72c72
< {{ processString(ddprefix) }}
---
> {{ ddprefix }}
94c94
< {{ flatString(processString(lrow.title,1),1) }}
---
> {{ flattenText(lrow.title) }}
106c106
< {{ processString(ddsuffix) }}
---
> {{ ddsuffix }}
130c130
< <div class="ddprefix ls-input-group-extra">{{ processString(ddprefix) }}</div>
---
> <div class="ddprefix ls-input-group-extra">{{ ddprefix }}</div>
143c143
< {{ flatString(processString(lrow.title,1),1) }}
---
> {{ flattenText(lrow.title) }}
155c155
< <div class="ddsuffix ls-input-group-extra">{{ processString(ddsuffix) }}</div>
---
> <div class="ddsuffix ls-input-group-extra">{{ ddsuffix }}</div>
ollehar

ollehar

2021-03-09 15:06

administrator   ~62940

> Not for me (with gif)

I mean, with same logic. :) Yes, it works in LS3.
DenisChenu

DenisChenu

2021-03-09 15:08

developer   ~62941

Here ?
https://github.com/LimeSurvey/LimeSurvey/blob/12cd8e5a2ca9975a3a45a0b10ca0630344d55e7d/assets/packages/expressions/em_javascript.js#L225-L240
DenisChenu

DenisChenu

2021-03-09 15:09

developer   ~62942

$(this).attr('name') !== $(this).attr('id')
ollehar

ollehar

2021-03-09 15:20

administrator   ~62943

$aQuestionsWithDependencies is empty.
DenisChenu

DenisChenu

2021-03-09 15:34

developer   ~62944

Last edited: 2021-03-09 15:34

View 2 revisions

````
/* select/dropdown item */
$(document).on("change",".select-item select:not([onchange]),.dropdown-item select:not([onchange])",function(event){
    checkconditions($(this).val(), $(this).attr('name').replace("#", "_"), 'select-one', 'change')
});
/* radio/button item */
$(document).on("change",".radio-item :radio:not([onclick]), .button-item :radio:not([onclick])",function(event){
    checkconditions($(this).val(), $(this).attr('name').replace("#", "_"), 'radio', 'click')
});
/* checkbox item */
$(document).on("change",".checkbox-item :checkbox:not([onclick]),.button-item :checkbox:not([onclick])",function(event){
    checkconditions($(this).val(), $(this).attr('name').replace("#", "_"), 'checkbox', 'click')
});
/* hidden item */
$(document).on("updated",".answer-item :hidden",function(event){
    checkconditions($(this).val(), $(this).attr('name').replace("#", "_"), 'equation', 'updated')
});
````

work : you can assign to me
DenisChenu

DenisChenu

2021-03-09 15:34

developer   ~62945

markdown disable ?
ollehar

ollehar

2021-03-09 15:54

administrator   ~62949

$aQuestionsWithDependencies is empty in LS3 too, checking method GetRelevanceAndTailoringJavaScript.
DenisChenu

DenisChenu

2021-03-09 15:57

developer   ~62950

Did you test https://bugs.limesurvey.org/view.php?id=16610#c62944 ?
ollehar

ollehar

2021-03-09 15:58

administrator   ~62951

> Did you test https://bugs.limesurvey.org/view.php?id=16610#c62944 ?

Not yet, one sec...
DenisChenu

DenisChenu

2021-03-09 16:03

developer   ~62952

I do :)

Reason : name (and column) of dual scale are {SGQA}_{SQ}#0 and {SGQA}_{SQ}#1 , but # broke in ID, then replace by {SGQA}_{SQ}_0 and {SGQA}_{SQ}_1

Dual scale are the only one with # in name (and column)
ollehar

ollehar

2021-03-09 16:11

administrator   ~62953

This assume "_" are not allowed in question codes, right? Or answer codes.
DenisChenu

DenisChenu

2021-03-09 16:13

developer   ~62954

> This assume "_" are not allowed in question codes, right? Or answer codes.

… since years (1.92 i think)

https://github.com/LimeSurvey/LimeSurvey/blob/12cd8e5a2ca9975a3a45a0b10ca0630344d55e7d/application/models/Question.php#L198

We allow bad values in survey done before (if no update of question code)
ollehar

ollehar

2021-03-09 19:11

administrator   ~62970

checkconditions() seem to behave identically in both LS3 and LS4. :|
ollehar

ollehar

2021-03-09 19:12

administrator   ~62971

Guess I could compare how ExprMgr_process_relevance_and_tailoring is generated. :d
DenisChenu

DenisChenu

2021-03-09 19:17

developer   ~62972

@ollehar : seriously ?

The difference is only in javascript … for array_dual_scale
Check https://github.com/LimeSurvey/LimeSurvey/blob/d603a29c5bde04c72c1061eb1b985168c7635e54/application/helpers/qanda_helper.php#L5560

Did you try checkconditions($(this).val(), $(this).attr('name').replace("#", "_"), 'select-one', 'change')

And see https://github.com/LimeSurvey/LimeSurvey/blob/d603a29c5bde04c72c1061eb1b985168c7635e54/assets/scripts/dualscale.js#L22


Denis
ollehar

ollehar

2021-03-09 19:22

administrator   ~62973

> Did you try checkconditions($(this).val(), $(this).attr('name').replace("#", "_"), 'select-one', 'change')

No, because this change is not needed in LS3.

LEMval('222593X8X95SQ003#0.NAOK') works in LS3 too but not in LS4.

Thanks for the links.
ollehar

ollehar

2021-03-09 19:24

administrator   ~62974

Oh, you fixed this in 2013 already...
DenisChenu

DenisChenu

2021-03-09 19:41

developer   ~62975

I think we lost https://github.com/LimeSurvey/LimeSurvey/blob/d603a29c5bde04c72c1061eb1b985168c7635e54/assets/scripts/dualscale.js#L22 file in 4.X
ollehar

ollehar

2021-03-09 19:42

administrator   ~62976

Yes, Markus forgot it. I pushed it now to branch bug/16610-conditionals-dual-scale.
ollehar

ollehar

2021-03-09 19:44

administrator   ~62977

Last edited: 2021-03-09 19:44

View 2 revisions

Real fix would be to remove `#` from question name/id, I guess. :d
DenisChenu

DenisChenu

2021-03-09 19:44

developer   ~62978

> Real fix would be to remove `#` from question name/id, I guess. :d

Unsure : my opinion is : use same name than column. Then need to remove the # from column too.
ollehar

ollehar

2021-03-10 11:03

administrator   ~62986

Maybe we need to remove $() and replace it with document.getElementById() then?

@DenisChenu You have time to test my commit in the branch bug/16610-conditionals-dual-scale?
DenisChenu

DenisChenu

2021-03-10 11:29

developer   ~62987

> Maybe we need to remove $() and replace it with document.getElementById() then?

? why ? There are currently issue in 3.15 with expression manager using getElementById

And here : we use `$(this).attr('name')` in javascript event.

i know HTML5 allow # in id , the n we can get $(this).attr('name') === $(this).attr('id') but we need to update all Expressionmanager class …
ollehar

ollehar

2021-03-10 11:48

administrator   ~62990

> ? why ? There are currently issue in 3.15 with expression manager using getElementById

To avoid collision with `#` sign.
DenisChenu

DenisChenu

2021-03-10 15:33

developer   ~62998

In 3.X

The active element have name with #
All other element have _ and not # : id (with value) for each input and _ for the hidden input used by Expressionmanager javascript

The action was done by dualscale.js
 The global on action in em_javascript start in 2015 : https://github.com/LimeSurvey/LimeSurvey/commit/ef6d25f8bacfce6bf3cf1030aeddc9dc7478ae3c#diff-f618aa50447d9c6aa9e3f5967cdb5e410275588d1ef5194613c66217e791f502

For information in 2.6lst : we have a lot of 'onclick="checkconditions($(this).val(), $(this).attr('name'))"' in HTML source.
This make javascript workaround more complex to do …

Expression Manager function seems near same in HTML source of 3.X and 4.X
The input name to used by EM name is done in LEMalias2varName array https://github.com/LimeSurvey/LimeSurvey/blob/610446dac91b6544058ecf5e914c7ac009a79be7/assets/packages/expressions/em_javascript.js#L979-L980

Then:
1. Speed and easy solution #1 : fix and add dualscale.js
2. Speed and easy solution #2 : fix em_javascript to replace # by _ : make a decision about id contain only _
3. Complex solution (and potential bug) : move from $("#ID") to getElementById … (and unusre it fix this issue)

:D
DenisChenu

DenisChenu

2021-03-10 15:34

developer   ~62999

PS : id have _ already
ollehar

ollehar

2021-03-10 15:37

administrator   ~63000

That's great, but can you also please test my commit? Or read and approve it?
DenisChenu

DenisChenu

2021-03-10 15:54

developer   ~63002

Oups …
Yes sorry :)
DenisChenu

DenisChenu

2021-03-10 16:05

developer   ~63005

Another issue …

But same in 3.X !

Fix is OK
ollehar

ollehar

2021-03-10 16:06

administrator   ~63006

Thanks.
ollehar1

ollehar1

2021-03-10 16:06

reporter   ~63007

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

DenisChenu

2021-03-10 16:19

developer   ~63013

Did you open a Dev mantis for jquery VS javascript AND id VS name ?
ollehar

ollehar

2021-03-10 16:22

administrator   ~63015

Nope. I will start looking at the 192 bugs marked as partially blocking now.
lime_release_bot

lime_release_bot

2021-03-15 15:37

administrator   ~63378

Fixed in Release 4.4.13+210315

Related Changesets

LimeSurvey: master 8de39019

2021-03-09 19:42:00

ollehar1

Details Diff
Fixed issue 16610: Conditionals with Array Dual Scale not working Affected Issues
16610
mod - application/core/QuestionTypes/ArrayMultiscale/RenderArrayMultiscale.php Diff File

Issue History

Date Modified Username Field Change
2020-08-22 23:04 mikeinpdx New Issue
2020-08-22 23:04 mikeinpdx File Added: limesurvey_survey_543276.lss
2021-03-03 14:46 ollehar Priority none => normal
2021-03-03 14:46 ollehar Description Updated View Revisions
2021-03-03 14:46 ollehar Additional Information Updated View Revisions
2021-03-03 14:46 ollehar Assigned To => ollehar
2021-03-03 14:46 ollehar Status new => feedback
2021-03-03 14:46 ollehar Note Added: 62651
2021-03-03 15:01 DenisChenu Note Added: 62660
2021-03-03 15:01 DenisChenu File Added: Capture d’écran du 2021-03-03 14-57-54.png
2021-03-03 15:07 DenisChenu Relationship added related to 17160
2021-03-03 15:16 DenisChenu Note Added: 62663
2021-03-03 15:16 DenisChenu File Added: limesurvey_survey_543276_updated.lss
2021-03-03 15:17 DenisChenu Note Added: 62664
2021-03-03 15:17 DenisChenu File Added: Peek 03-03-2021 15-17.gif
2021-03-09 14:14 ollehar Note Added: 62932
2021-03-09 14:14 ollehar Status feedback => new
2021-03-09 14:23 ollehar Note Added: 62933
2021-03-09 14:23 ollehar Note Edited: 62933 View Revisions
2021-03-09 14:54 ollehar Note Added: 62934
2021-03-09 14:54 ollehar Status new => assigned
2021-03-09 15:03 ollehar Note Added: 62935
2021-03-09 15:03 ollehar File Added: limesurvey_survey_222593.lss
2021-03-09 15:03 DenisChenu Note Added: 62936
2021-03-09 15:03 DenisChenu File Added: limesurvey_survey_arrayDual3LTS.lss
2021-03-09 15:05 ollehar Note Added: 62937
2021-03-09 15:06 DenisChenu Note Added: 62938
2021-03-09 15:06 DenisChenu File Added: Peek 09-03-2021 15-05.gif
2021-03-09 15:06 ollehar Note Added: 62939
2021-03-09 15:06 ollehar Note Added: 62940
2021-03-09 15:08 DenisChenu Note Added: 62941
2021-03-09 15:09 DenisChenu Note Added: 62942
2021-03-09 15:20 ollehar Note Added: 62943
2021-03-09 15:34 DenisChenu Note Added: 62944
2021-03-09 15:34 DenisChenu Note Edited: 62944 View Revisions
2021-03-09 15:34 DenisChenu Note Added: 62945
2021-03-09 15:54 ollehar Note Added: 62949
2021-03-09 15:57 DenisChenu Note Added: 62950
2021-03-09 15:58 ollehar Note Added: 62951
2021-03-09 16:03 DenisChenu Note Added: 62952
2021-03-09 16:11 ollehar Note Added: 62953
2021-03-09 16:13 DenisChenu Note Added: 62954
2021-03-09 19:11 ollehar Note Added: 62970
2021-03-09 19:12 ollehar Note Added: 62971
2021-03-09 19:17 DenisChenu Note Added: 62972
2021-03-09 19:22 ollehar Note Added: 62973
2021-03-09 19:24 ollehar Note Added: 62974
2021-03-09 19:41 DenisChenu Note Added: 62975
2021-03-09 19:42 ollehar Note Added: 62976
2021-03-09 19:43 ollehar Status assigned => testing
2021-03-09 19:44 ollehar Note Added: 62977
2021-03-09 19:44 ollehar Note Edited: 62977 View Revisions
2021-03-09 19:44 DenisChenu Note Added: 62978
2021-03-09 20:57 ollehar Summary Conditionals with Array Dual Scale not working? => Conditionals with Array Dual Scale not working
2021-03-10 11:03 ollehar Note Added: 62986
2021-03-10 11:29 DenisChenu Note Added: 62987
2021-03-10 11:48 ollehar Note Added: 62990
2021-03-10 15:33 DenisChenu Note Added: 62998
2021-03-10 15:33 DenisChenu File Added: Capture d’écran du 2021-03-10 15-27-48.png
2021-03-10 15:33 DenisChenu File Added: Capture d’écran du 2021-03-10 15-28-00.png
2021-03-10 15:34 DenisChenu Note Added: 62999
2021-03-10 15:34 DenisChenu File Added: Capture d’écran du 2021-03-10 15-34-16.png
2021-03-10 15:37 ollehar Note Added: 63000
2021-03-10 15:54 DenisChenu Note Added: 63002
2021-03-10 16:05 DenisChenu Note Added: 63005
2021-03-10 16:06 ollehar Note Added: 63006
2021-03-10 16:06 ollehar1 Changeset attached => LimeSurvey master 8de39019
2021-03-10 16:06 ollehar1 Note Added: 63007
2021-03-10 16:07 ollehar Status testing => resolved
2021-03-10 16:07 ollehar Resolution open => fixed
2021-03-10 16:14 DenisChenu Relationship added related to 17174
2021-03-10 16:19 DenisChenu Note Added: 63013
2021-03-10 16:22 ollehar Note Added: 63015
2021-03-15 15:37 lime_release_bot Note Added: 63378
2021-03-15 15:37 lime_release_bot Status resolved => closed