I
I
Igor Vasiliev2017-10-08 22:32:15
Yii
Igor Vasiliev, 2017-10-08 22:32:15

How to save data and work with it on bootstrap-slider?

Hello.
--
There is a bootstrap-slider.js script that makes an interesting type=range out of the input.
I like it externally, but turned out to be capricious when I applied it to a Yii2 search.
Like any other input, there is a value that passes data:

<input id="ex1" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="20" data-slider-step="1" data-slider-value="14"/>

So it is here, but data-slider-value for some reason does not pass anything to $_get, and it is not clear where to push this value that is selected so that the range tracker is at the selection mark, even if the page is reloaded. Addendum, type:
<?=$form->field($model, 'word')->textInput(['value' => $model->word]);?>

or:
<?=$form->field($model, 'word')->textInput(['value' => $get['ClassSearch']['word']]);?>

Useless. as well as:
<?=$form->field($model, 'word')->textInput(['data-slider-value' => $get['ClassSearch']['word']]);?>
...
<?=$form->field($model, 'word')->textInput(['data-slider-value' => $model->word]);?>

I'm already silent about the transfer of two parameters, since even one is not transferred. Who worked with it? Tell.
Description links:
https://www.npmjs.com/package/bootstrap-slider
https://cdnjs.com/libraries/bootstrap-slider
seiyria.com/bootstrap-slider Thanks
in advance for your help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Gogolinsky, 2017-10-08
@Isolution666

When submitting the form, you will not be passed any data-parameters, as well as id, classes, inline styles and other attributes of the input. Only name and value. All.
You will have to write your own processing: when changing in value, you can enter JSON with the left and right values.
You can look for ready-made solutions, perhaps the standard plugin www.yiiframework.com/doc-2.0/yii-jui-sliderinput.html can

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question