View Issue Details

IDProjectCategoryView StatusLast Update
12715Bug reports[All Projects] Survey designpublic2018-03-15 13:40
Reporterkatcher01Assigned Tomarkusfluer 
PrioritynoneSeveritymajor 
Status closedResolutionreopened 
Product Version2.65.x 
Target VersionFixed in Version3.5.x 
Summary12715: Behavior change for numericalmultiple Slider default value when 0 or null Upgraded PHP version
DescriptionThe slider behavior for default 0 or default null has changed.

Situation 1 version 2.05+ MultiNumerical Slider:
Scale -> 0 -> 100
Default value -> null or 0 (zero)

Slider would default to 0

Situation 2 version 2.65+ MultiNumerical Slider:
Scale -> 0 -> 100
Default value -> null or 0 (zero)

Slider would default to 5

If min value selected other than 0 (zero) the slider appears to work as expected.


If a user left the default slider value empty and the scale was from 0-x it would start at 0. This behavior appears to have changed.
An existing survey used scale 0-100 but left the default empty. The observed behavior was the slider began at 5. If the user set the default to 0 (zero) it still started at 5. The test for empty changed between versions.
Steps To ReproduceCreate a question with slider option

select scale 0 - 100
do not select slider default (null) or select slider_default = 0
Slider displays 5 as start point
Additional Information2.05+ code performed the following test for null or zero

// from application\helpers\qanda_helper.php

if ($slider_default != "")
        {
            $slider_startvalue = $slider_default;
            $slider_displaycallout=1;
        }
        elseif ($slider_middlestart != '')
        {
            $slider_startvalue = $slider_middlestart;
            $slider_displaycallout=0;
        }
        else
        {
            $slider_startvalue = 'NULL';
            $slider_displaycallout=0;
        }
        $slider_showminmax=($aQuestionAttributes['slider_showminmax']==1)?1:0;



Current Test 2.67+


$sliderStart = 'null';
if($dispVal) //posted value => higest priority
{
    $sliderStart = $dispVal;
}
else if($slider_default) //
{
    $sliderStart = $slider_default;
}
else if($slider_middlestart==1) //
{
    $sliderStart = intval(($slider_max + $slider_min)/2);
}

$slider_default will never be evaluated if default value is null or 0.
TagsNo tags attached.
Complete LimeSurvey version number (& build) 2.67.3+170728 (or earlier)
I will donate to the project if issue is resolvedNo
Browsernot important
Database & DB-VersionMSSQL
Operating System (Server)Windows Server 2008 R2 Datacenter Edition Service Pack 1
Webserver software & versionApache/2.4.27 (Win32)
PHP Version5.6.31

Activities

katcher01

katcher01

2017-10-02 21:11

reporter   ~44537

I have used th efollowing code in my test environment.


//Three cases:
// 1: posted value safed
// 2: default value set
// 3: slider starts in middle position

$sliderStart = 'null';
if($dispVal) //posted value => higest priority
{
    $sliderStart = $dispVal;
}
else if($slider_default != "")
{
    $sliderStart = $slider_default;
}
else if ($slider_default == "" && $slider_middlestart!=1) {
    $sliderStart = $slider_min;
}
else if($slider_middlestart==1) //
{
    $sliderStart = intval(($slider_max + $slider_min)/2);
}
c_schmitz

c_schmitz

2018-02-09 17:02

administrator   ~46359

Version 3.3.0 released
thrystan

thrystan

2018-02-26 17:44

reporter   ~46762

Same bug in Version 3.4.0+180219
Slider default always to 5, even if I change min value.
Behaviour change only if I set both "Slider initial value" and "Slider initial value set at start:On"
But I want no default value.
markusfluer

markusfluer

2018-03-12 14:08

developer   ~47022

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

Related Changesets

LimeSurvey: master c6479cbd

2018-03-12 14:07:47

markusfluer

Details Diff
Fixed issue 12715: Behavior change for numericalmultiple Slider default value when 0 or null Upgraded PHP version
mod - application/helpers/qanda_helper.php Diff File
mod - application/views/survey/questions/answer/multiplenumeric/rows/sliders/answer_row.twig Diff File
mod - assets/packages/questions/numeric-slider/scripts/numeric-slider.js Diff File

Issue History

Date Modified Username Field Change
2017-09-26 15:14 katcher01 New Issue
2017-10-02 21:11 katcher01 Note Added: 44537
2018-02-07 12:57 markusfluer Assigned To => markusfluer
2018-02-07 12:57 markusfluer Status new => resolved
2018-02-07 12:57 markusfluer Resolution open => fixed
2018-02-07 12:57 markusfluer Fixed in Version => 3.2.x
2018-02-09 17:02 c_schmitz Note Added: 46359
2018-02-09 17:02 c_schmitz Status resolved => closed
2018-02-26 17:44 thrystan Note Added: 46762
2018-02-27 08:42 c_schmitz Status closed => feedback
2018-02-27 08:42 c_schmitz Resolution fixed => reopened
2018-03-12 14:08 markusfluer Changeset attached => LimeSurvey master c6479cbd
2018-03-12 14:08 markusfluer Note Added: 47022
2018-03-12 15:12 markusfluer Status feedback => resolved
2018-03-15 13:40 olle Status resolved => closed
2018-03-15 13:40 olle Fixed in Version 3.2.x => 3.5.x