[SOLVED] Why can't I pass the value from datepicker to the controller?

I’m trying to pass the values of date from the datepicker to the controller, but since now, there’s no success. When I clicked the submit button, the page just refreshes, without any updates to table. Using var_dump on $model reveals that the value of $start isn’t actually transferred to the controller. I also tried hardcoding the value of $start at the controller, and it manages to actually passed to the model, and subsequently returned the correct results on the GridView below.

Here’s the code:


use yii\widgets\ActiveForm;
<?php $form=ActiveForm::begin([
     'options' => ['class' => 'form-vertical',],
]) ?>
 echo $form->field($model, 'start')->widget(
     'language' => 'en',
     'dateFormat' => 'yyyy-MM-dd',


 use app\models\Model;
 public function actionIndex()
     $model = new Model;  
     $test = Yii::$app->request->post();
     echo VarDumper::dump($test); 
     $dataProvider = $model->getSomething();
     return $this->render('index', [
         'dataProvider' => $dataProvider,
         'model' => $model,


use yii\data\ActiveDataProvider;
public class Model extends \yii\db\ActiveRecord

    public $start

    public function getSomething()
        $query = (new \yii\db\Query());
        . //Query to be performed
        $provider = new ActiveDataProvider([
             'query' => $query,
        return $provider;

Hi @TimBluesWin,

What do you get with the dump? What are there in the POST?

In Model.php you need the function:

public function rules()	{
		return [
			[['start'], 'safe'],

Thanks so much! Adding rules finally works!

And btw, echo VarDumper::dump($test); shows the correct $test value, so yes, the problem is the load method did not execute.