CJuiSliderInput displays a slide. it also encapsulates the JUIslider plug-in and can be used in Form as the UI component for user input. CJuiSliderInput displays a slide. it also encapsulates the JUI slider plug-in and can be used in Form as the UI component for user input.
The basic usage is as follows:
beginWidget('CActiveForm'); ?> errorSummary($model); ?>widget('zii.widgets.jui.CJuiSliderInput', array('model'=>$model,'attribute'=>'size','name'=>'my_slider','value'=>50,'event'=>'change','options'=>array('min'=>0,'max'=>100,'slide'=>'js:function(event,ui){$("#amount").text(ui.value);}',),'htmlOptions'=>array('style'=>'width:200px; float:left;'),)); ?>50endWidget(); ?>
After the user submits the request, use result. php to display the value entered by the user. DataModel is defined as follows:
class DataModel extends CFormModel{public $size;public function rules(){return array(array('size', 'safe'),);}}
Modify the indexAction method of SiteController:
public function actionIndex(){$model=new DataModel();$model->size=50;if(!emptyempty($_POST['DataModel'])){$model->attributes=$_POST['DataModel'];if($model->validate()){$this->render('result', array('model' => $model,));return;}}$this->render('index', array('model' => $model,));}
The above is the content of the Zii component-SliderInput sample in the PHP development Framework Yii Framework tutorial (40). For more information, see PHP Chinese website (www.php1.cn )!