diff --git a/application/helpers/qanda_helper.php b/application/helpers/qanda_helper.php
index a3a0c337a85..e6fcefc6b0e 100644
--- a/application/helpers/qanda_helper.php
+++ b/application/helpers/qanda_helper.php
@@ -3094,6 +3094,23 @@ function do_multiplenumeric($ia)
$slider_separator= (trim($aQuestionAttributes['slider_separator'])!='')?$aQuestionAttributes['slider_separator']:"";
$slider_reset=($aQuestionAttributes['slider_reset'])?1:0;
+
+ 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;
+ }
+
}
else
{
@@ -3128,7 +3145,6 @@ function do_multiplenumeric($ia)
$anscount = count($aSubquestions)*2;
$fn = 1;
-
$answer = Yii::app()->getController()->renderPartial('/survey/questions/multiplenumeric/header', array('prefixclass'=>$prefixclass), true);
$answer_main = '';
@@ -3223,6 +3239,8 @@ function do_multiplenumeric($ia)
'slider_handle' => $slider_handle,
'slider_reset' => $slider_reset,
'slider_custom_handle' => $slider_custom_handle,
+ 'slider_startvalue' => $slider_startvalue,
+ 'slider_displaycallout' => $slider_displaycallout
);
$answer .= Yii::app()->getController()->renderPartial('/survey/questions/multiplenumeric/item', $itemDatas, true);
diff --git a/application/views/survey/questions/multiplenumeric/item.php b/application/views/survey/questions/multiplenumeric/item.php
index 233e3530861..b4e49f7f41a 100644
--- a/application/views/survey/questions/multiplenumeric/item.php
+++ b/application/views/survey/questions/multiplenumeric/item.php
@@ -63,13 +63,15 @@ class="text form-control "
data-slider-reset=''
data-slider-prefix=''
data-slider-suffix=''
+ data-slider-startvalue=''
+ data-slider-displaycallout=''
/>
-
+
@@ -100,17 +102,54 @@ class="text form-control "
$(document).ready(function(){
var myfname = '';
var id = '#answer' + myfname;
+ var resetSliderId = id + '_resetslider';
+ var slider_prefix = $(id).attr('data-slider-prefix')
+ var slider_suffix = $(id).attr('data-slider-suffix')
+
var mySlider_ = $(id).bootstrapSlider({
formatter: function (value) {
- var slider_prefix = $(id).attr('data-slider-prefix')
- var slider_suffix = $(id).attr('data-slider-suffix')
var displayValue = '' + value;
var displayValue = displayValue.replace(/\./,LSvar.sLEMradix);
return slider_prefix + displayValue + slider_suffix;
}
});
+
+ // Set "This value" at init
+ var slider_startvalue = $(id).attr('data-slider-startvalue');
+ var displayValue = '' + slider_startvalue;
+ var displayValue = displayValue.replace(/\./,LSvar.sLEMradix);
+ $(id).attr('stringvalue', displayValue);
+ $(id).triggerHandler("keyup");
+
+ // Reset on click on .slider-reset
+ $(resetSliderId).on("click", function() {
+ var slider_startvalue = $(id).attr('data-slider-startvalue');
+ var slider_displaycallout = $(id).attr('data-slider-displaycallout');
+
+ if(slider_startvalue == "NULL") {
+ $(id).bootstrapSlider('setValue', '');
+ $(id).attr('stringvalue', '');
+ }
+ else {
+ $(id).bootstrapSlider('setValue', parseFloat(slider_startvalue));
+ $(id).attr('stringvalue', slider_startvalue);
+ }
+
+ if(slider_displaycallout && slider_startvalue != "NULL") {
+ $(id).attr('stringvalue', slider_prefix + slider_startvalue.replace(/\./,LSvar.sLEMradix) + slider_suffix);
+ $(id).bootstrapSlider('setValue', parseFloat(slider_startvalue));
+ }
+ else {
+ $(id).bootstrapSlider('setValue', '');
+ $(id).attr('stringvalue', '');
+ }
+
+ LEMrel();
+ $(id).triggerHandler("keyup"); // Needed for EM
+ });
+
mySlider_.on('slideStop', function(event) {
- var displayValue = '' + event.value;
+ var displayValue = '' + event.value; // Type-cast to string
var displayValue = displayValue.replace(/\./,LSvar.sLEMradix);
// fixnum_checkconditions can't handle dot if it expects comma, and