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. Basic usage: [php] <div class = "form"> <? Php $ form = $ this-> beginWidget ('cactiveform');?> <? Php echo $ form-> errorSummary ($ model);?> <? Php $ this-> 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; '),);?> <Div id = "amount" style = "margin-left: 215px;"> 50 </div> <div class = "row submit"> <? Php echo CHtml: submitButton ('submit ');?> </Div> <? Php $ this-> endWidget ();?> </Div> <! -- Form --> <div class = "form"> <? Php $ form = $ this-> beginWidget ('cactiveform');?> <? Php echo $ form-> errorSummary ($ model);?> <? Php $ this-> 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; '),);?> <Div id = "amount" style = "margin-left: 215px;"> 50 </div> <div class = "row submit"> <? Php echo CHtml: submitButton ('submit ');?> </Div> <? Php $ this-> endWidget ();?> </Div> <! -- Form --> after the user submits the request, use result. php to display user input values. DataModel is defined as follows: [php] class DataModel extends CFormModel {public $ size; public function rules () {return array ('SIZE ', 'Safe '),) ;}} class DataModel extends CFormModel {public $ size; public function rules () {return array ('SIZE ', 'Safe '),) ;}} modify the indexAction method of SiteController: [php] public function actionIndex () {$ model = new DataModel (); $ model-> si Ze = 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,);} public function actionIndex () {$ model = new DataModel (); $ model-> size = 50; if (! Empty ($ _ POST ['datamodel ']) {$ model-> attributes = $ _ POST ['datamodel']; if ($ model-> validate ()) {$ this-> render ('result', array ('model' => $ model,); return ;}$ this-> render ('index ', array ('model' => $ model ,));}
-