yiisoft/yii — pull request #1685 by resurtm (2012-11-10 07:27:50+00:00)
Title: Fixes #1065. CJuiSlider is now more customizable.

Fixes #1065. CJuiSlider is now more customizable.

Testing code:

```php

widget('zii.widgets.jui.CJuiSliderInput',array(
'id'=>'slider1',
'name'=>'price',
'value'=>150,
'options'=>array(
'min'=>100,
'max'=>500,
),
)); ?>
widget('zii.widgets.jui.CJuiSliderInput',array(
'id'=>'slider2',
'name'=>'priceStart',
'value'=>150,
'maxName'=>'priceStop',
'maxValue'=>400,
'options'=>array(
'range'=>true,
'min'=>100,
'max'=>500,
),
'idEndSuffix'=>'End',
)); ?>

widget('zii.widgets.jui.CJuiSliderInput',array(
'id'=>'slider3',
'model'=>new TestModel1(),
'attribute'=>'price',
'options'=>array(
'min'=>100,
'max'=>500,
),
)); ?>
widget('zii.widgets.jui.CJuiSliderInput',array(
'id'=>'slider4',
'model'=>new TestModel2(),
'attribute'=>'priceStart',
'maxAttribute'=>'priceStop',
'options'=>array(
'range'=>true,
'min'=>100,
'max'=>500,
),
'idEndSuffix'=>'End',
)); ?>

// ...

public function actionIndex()
{
if(Yii::app()->request->isPostRequest)
{
CVarDumper::dump($_POST);
Yii::app()->end();
}

$this->render('index');
}
```

After submitting form above following ouput will happen:

```
array
(
'price' => '150'
'priceStart' => '150'
'priceStop' => '400'
'TestModel1' => array
(
'price' => '150'
)
'TestModel2' => array
(
'priceStart' => '150'
'priceStop' => '400'
)
'yt0' => 'submit'
)
```

Generated HTML:

```html

```

Generated JS:

```js
jQuery(function($) {
jQuery('#slider1_slider').slider({'min':100,'max':500,'value':150,'slide':function(event, ui) { jQuery('#slider1').val(ui.value); }});

jQuery('#slider2_slider').slider({'range':true,'min':100,'max':500,'value':150,'maxValue':400,'values':[150,400],'slide':function(e,ui){ v=ui.values; jQuery('#slider2').val(v[0]); jQuery('#slider2End').val(v[1]); }});

jQuery('#slider3_slider').slider({'min':100,'max':500,'value':150,'slide':function(event, ui) { jQuery('#slider3').val(ui.value); }});

jQuery('#slider4_slider').slider({'range':true,'min':100,'max':500,'value':150,'maxValue':400,'values':[150,400],'slide':function(e,ui){ v=ui.values; jQuery('#slider4').val(v[0]); jQuery('#slider4End').val(v[1]); }});

});
```