Skip to content

Commit

Permalink
Fixed issue #09220: Slider cannot be changed if decimal separator is …
Browse files Browse the repository at this point in the history
…comma and Slider accuracy is less than 1

Dev: LEM radix
  • Loading branch information
Shnoulle committed Sep 11, 2014
1 parent 6e03b54 commit 16fdc40
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions scripts/numeric-slider.js
Expand Up @@ -31,17 +31,14 @@ function doNumericSlider(qID,jsonOptions) {
$("#question"+qID+" .slider-list").children('.answer-item').each(function(){
var thisinput=$(this).children(".input").children('input.text').first();
var myfname=$(thisinput).attr('name');
var actualval=$(thisinput).attr('value');
var actualval=$(thisinput).attr('value').replace(LSvar.sLEMradix,".");
var havevalue=false;
var startvalue=false;
if(actualval!=""){
havevalue==true;
havevalue=true;
startvalue=actualval;
}else{
havevalue==false;
if(jsonOptions.slider_startvalue=="NULL"){
startvalue=false;
}else{
startvalue=parseFloat(jsonOptions.slider_startvalue);
}
}else if(jsonOptions.slider_startvalue!="NULL"){
startvalue=parseFloat(jsonOptions.slider_startvalue);
}
$(this).children(".input").hide();
$(htmlSlider.replace(/myfname/g,myfname)).insertAfter($(this).children(".input"));
Expand All @@ -56,15 +53,15 @@ function doNumericSlider(qID,jsonOptions) {
$('#slider-callout-'+myfname).appendTo($('#container-'+myfname+' .ui-slider-handle').get(0));
},
slide: function( event, ui ) {
displayvalue=''+ui.value;
displayvalue=displayvalue.replace(/\./,LSvar.sLEMradix);
displayvalue=''+ui.value;
displayvalue=displayvalue.replace(/\./,LSvar.sLEMradix);
$(thisinput).val(displayvalue);
$(thisinput).triggerHandler("keyup");
$('#slider-callout-'+myfname).text(jsonOptions.slider_prefix + displayvalue + jsonOptions.slider_suffix);
}
});
// Update the value of the input if Slider start is set
if(!havevalue && startvalue && jsonOptions.slider_displaycallout){
if(havevalue || ( startvalue && jsonOptions.slider_displaycallout)){
startvalue=''+startvalue;
startvalue=startvalue.replace(/\./,LSvar.sLEMradix);
$("#slider-callout-"+myfname).text(jsonOptions.slider_prefix + startvalue + jsonOptions.slider_suffix);
Expand All @@ -79,7 +76,6 @@ function doNumericSlider(qID,jsonOptions) {
$( "#container-"+myfname ).slider( "option", "value", jsonOptions.slider_startvalue );
}
if(jsonOptions.slider_displaycallout && jsonOptions.slider_startvalue!="NULL"){

$('#slider-callout-'+myfname).text(jsonOptions.slider_prefix + jsonOptions.slider_startvalue.replace(/\./,LSvar.sLEMradix) + jsonOptions.slider_suffix);
$(thisinput).val(jsonOptions.slider_startvalue);
}else{
Expand Down

0 comments on commit 16fdc40

Please sign in to comment.