kartik-v / yii2-slider

A slider input with orientations, range selections and more features based on bootstrap-slider.
http://demos.krajee.com/slider
Other
28 stars 20 forks source link

fix #16 #25

Closed onmotion closed 7 years ago

onmotion commented 7 years ago

By default, the plugin has init value is 5. If my model does not have a numeric value (e.g. string '0' instead), or value is null, my slider min value will be = 5. Now you can set up any value.

kartik-v commented 7 years ago

This does not seem to be correct and not sure it is needed.

If you need an initial value to be set ... then just directly set it in the value property ... e.g.

echo Slider::widget([
   'name' => 'your-slider-input',
   'value' => ' ', // enter your initial value
]);

If using with model just set the model attribute value to default value before initializing:

// if slider_input is the name of your model attribute
$model->slider_input = ' '; // set your input's initial value
echo Slider::widget([
   'model' => $model,
   'attribute' => 'slider_input'
]);