Slider range not setting handles properly

Slider range not setting handles properly

I'm trying to get jQueryUI Slider w/ two handles working (range).  It keeps generating 8 slider handles instead of just two and they aren't being set to the initial values.  ON change, I call ValSlider to get the values to update in the input box.  I'm using data to pull the required settings into the slider function (I have to share this data w/ other scripts, so using this as easiest way), but I don't see any problems w/ doing that.

Here's a demo:   [ Removed ]

Here's the related simplified code for slider (range):  (Tried to set up jsfiddle, but didn't have jqueryui )

  1. // call to set up slider & handle changes
  2. $('.slider').each(function() {
  3.         var minvalue = parseInt($(this).attr('data-minval'), 10);
  4.         var maxvalue = parseInt($(this).attr('data-maxval'), 10);
  5.         var rangevalue = $(this).attr('data-rangeval');
  6.         var stepvalue = parseInt($(this).attr('data-step'), 10);
  7.         if (rangevalue == "true") {var valvalue = $(this).attr('data-val')}
  8.         console.log('Valvalue: ' + valvalue);
  9.         if (rangevalue == "true") { // multiple values
  10.           $(this).slider({
  11.             animate: 'fast',
  12.             min: minvalue,
  13.             max: maxvalue,
  14.             range: rangevalue,
  15.             step: stepvalue,
  16.             values: valvalue,
  17.             change: function(event, ui) {
  18.               console.log('1Change: ' + ui.values[0] + ' 2Change: ' + ui.values[1]);
  19.               $(this).prev().val(ui.values[0] + "-" + ui.values[1]);
  20.               $(this).attr('data-change', 1);
  21.               var mychange = ui.handle;
  22.               console.log('Uihandle: ' , mychange);
  23.               var slname = $(mychange).parent().attr('name');
  24.               valSlider(slname,0)}
  25.           });
  26.         }
  27. }); 

  28. function valSlider(selname) {
  29.     var myname = selname;
  30.     console.log('valSlider - Slider name: ' + myname);
  31.     if (myname == "init") { // set initial value
  32.         // std form
  33.         console.log('Inside init/std form');
  34.         $('.slider').each(function() {
  35.           // multiple values
  36.           var sval = $(this).attr('data-val');
  37.           sval = sval.replace(/\, /g,'-').slice(1, -1);
  38.           console.log('Sval init/std: ' + sval);  
  39.           $(this).prev().val(sval);
  40.         });
  41.     }  
  42.     $('.slider').each(function() {
  43.       var slch = $(this).attr('data-change');
  44.       if (myname == "init") {return;} // don't run on init
  45.       console.log('Slider Change: ' + slch);
  46.       // indiv valuate
  47.       if (slch == 0) {return;}  // stop on unchanged indiv. sliders
  48.       console.log('Indiv Valuate');
  49.       var mythis = $('.slider[name="'+myname+'"]');
  50.       console.log('Mythis: ' , mythis);  
  51.       console.log('Mythis-name: ' , mythis.attr('name'));
  52.       console.log('Gen Val: ' + mythis.val());
  53.       console.log(' Slider Val: ' + mythis.slider('values'));
  54.       var slreq = 0;
  55.       if (mythis.attr('required') || mythis.hasClass('ok')) {console.log('Slider Req'); slreq = 1}
  56.       var slalert = 0;
  57.       if (slch == 0) {console.log('SliderCheck is 0'); slalert = 1}
  58.       if (slalert == 0 && slreq == 1) { // change req. to ok symbol
  59.         console.log('Change to OK');
  60.         mythis.removeAttr("required");
  61.         mythis.addClass("ok");
  62.         mythis.css({'border-color': '#cfd9db'});
  63.         if (mythis.attr('data-rangeval') == "false") {var nval = mythis.val()}
  64.         if (mythis.attr('data-rangeval') == "true") {
  65.           var fval = mythis.slider('values', 0);
  66.           var lval = mythis.slider('values', 1);
  67.           var nval = fval + '-' + lval;
  68.         }
  69.         console.log('Slider val1: ' + fval + ' Slider val2: ' + lval);
  70.         console.log('Slider val @ update: ' + nval);
  71.         mythis.prev().val(nval);
  72.       }   
  73.     });
  74.   }
  75.   valSlider('init',0);