0

I am creating a form and I want to have nouisliders for the users to pick a value. I need help with getting the value from the slider and set it to the input to be accessed by the controller.

<div class="row" style="padding-bottom: 10px;">    
    <div class="col-lg-6" style="width: 100%;">
         <p class="font-bold">Slider 1</p>
         <div id="slider1"></div>
         <input type="hidden" name="slider1Input" value="" id="slider1Input" />
    </div>  
</div>
<div class="row" style="padding-bottom: 10px;">
     <div class="col-lg-6" style="width: 100%;">
        <p class="font-bold">Slider 2</p>
       <div id="slider2"></div>
       <input id="slider2Input" type="hidden" value="">
    </div>
 </div>

Javascript

var slider1 = noUiSlider.create($("#slider1")[0], {
  start: 0,
  behaviour: 'tap',
  connect: 'lower',
  step: 10,
  tooltips: false,
  range: {
      'min':  0,
      'max':  100
    }
});

var slider2 = noUiSlider.create($("#slider2")[0], {
  start: 0,
  behaviour: 'tap',
  connect: 'lower',
  step: 10,
  tooltips: false,
  range: {
    'min':  0,
    'max':  100
  }
});
  • If this is a normal form then the hidden inputs will send those values to your controller. Check laravel's documentation for accessing form requests – Mihir Bhende Feb 04 '19 at 00:41
  • Possible duplicate of [Replace hidden field value with value of NoUiSlider value to pass to form PHP](https://stackoverflow.com/questions/33366971/replace-hidden-field-value-with-value-of-nouislider-value-to-pass-to-form-php) – Lg102 Feb 04 '19 at 07:43

0 Answers0