Changes between Initial Version and Version 2 of Ticket #8144


Ignore:
Timestamp:
Feb 29, 2012, 7:50:21 AM (8 years ago)
Author:
Scott González
Comment:

I've removed the code example in the ticket description. Please do not paste large blocks of code into a ticket (see the red box telling you not to for more info).

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #8144

    • Property Type changed from bug to feature
  • Ticket #8144 – Description

    initial v2  
    88
    99So it looks like the data validation part of the Slider code forces numeric values on the Min/Max/Step while the UI portion does not.
    10 
    11 Please see demo code below:
    12 
    13 {{{
    14 <link href="jquery-ui-1.8.18.custom.css" rel="stylesheet" type="text/css" />
    15 <script src="jquery-1.7.1.min.js" type="text/javascript"></script>
    16 <script src="jquery-ui-1.8.18.custom.min.js" type="text/javascript"></script>
    17 
    18 
    19 <input type="text" id="sliderInput" />
    20 <div id="slider"></div>
    21 
    22 
    23 <script>
    24 function WireUpSlider(sSliderID, sInputID, sMinMaxStep) {
    25     var a_iMinMaxStep = sMinMaxStep.split('|');
    26 
    27     $(sSliderID).slider({
    28         range: "min",
    29         min: a_iMinMaxStep[0],    //# Requires parseInt(a_iMinMaxStep[0])
    30         max: a_iMinMaxStep[1],    //# Requires parseInt(a_iMinMaxStep[1])
    31         step: a_iMinMaxStep[2],   //# Requires parseInt(a_iMinMaxStep[2])
    32         value: $(sInputID).val(),
    33         slide: function (event, ui) {
    34             $(sInputID).val(ui.value);
    35         }
    36     });
    37 
    38     $(sInputID).change(function () {
    39         var iValue = parseInt(this.value);
    40         if (!isNaN(iValue)) {
    41             $(sSliderID).slider("value", iValue);
    42         }
    43         //# rely on the .slider to enforce the range
    44         this.value = $(sSliderID).slider("value");
    45     });
    46 }
    47 
    48 WireUpSlider("#slider", "#sliderInput", "1|500|1");
    49 </script>
    50 }}}