Behavior change for numericalmultiple Slider (PHP version Upgrade)

More
1 month 3 weeks ago #158962 by katcher01
katcher01 created the topic: Behavior change for numericalmultiple Slider (PHP version Upgrade)
Hello,

Since we have upgraded our PHP version on our test server, the slider behavior for default 0 or null has changed. 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. In order for me to maintain the same behavior on exiting surveys I was proposing the following modification. Is this valid? I do think there is a bug in the slider test code.

Assumptions as per file comments


//the complicated default slider setting will be simplified header_remove
//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 != "") //Mod Default value set including 0 (zero)
{
$sliderStart = $slider_default;
}
else if ($slider_default == "" && $slider_middlestart!=1) { // Mod default not set and not slider middle
$sliderStart = $slider_min;
}
else if($slider_middlestart==1) //
{
$sliderStart = intval(($slider_max + $slider_min)/2);
}


This Kludge is not perfect as there may be some other checks - what if default value is less than or greater than the min or max?

Please comment.

Eric

Please Log in to join the conversation.

More
1 month 3 weeks ago #159005 by LouisGac
LouisGac replied the topic: Behavior change for numericalmultiple Slider (PHP version Upgrade)
Thank you for reporting. Could you please open a bug report, with a small survey to reproduce the bug?
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!