yii extensions - yii2: how to get slider range value -
i use kartik-v/yii2-slider in project .
with code added 1 slider range select :
echo '<b class="badge">$10</b> ' . slider::widget([ 'name'=>'rating_3', 'value'=>'250,650', 'slidercolor'=>slider::type_grey, 'pluginoptions'=>[ 'min'=>10, 'max'=>1000, 'step'=>5, 'range'=>true ], ]) . ' <b class="badge">$1,000</b>';
i have 2 column min value , max value in (set_money) table : min_money max_money
how can save thats variable in database !
i not know how variable in controller
in view file, in form
<?php echo '<b class="badge">$10</b> ' . slider::widget([ 'name'=>'min_money', 'value'=>'250,650', 'slidercolor'=>slider::type_grey, 'pluginoptions'=>[ 'min'=>10, 'max'=>1000, 'step'=>5, 'range'=>true ], ]) . ' <b class="badge">$1,000</b>';
in controller
public function actioncreate() { $model = new model; // give actual model name instead of model if($model->load(yii::$app->request->post())) { list($model->min_money, $model->max_money) = explode(',', $model->min_money); // both $model->min_money , $model->max_money set , contains value submitted in form kartik slider widget if($model->save(true)) { // success -> redirect } else { // error render form again } } }
Comments
Post a Comment