This works great for the update.php view, which places as a default value the existing date. However, for the create page, it puts 0000-00-00, instead of just an empty string. Any parameter to make it use blank on create.php, like how $form->textField() automatically does? Thanks.
I tried that but it still defaults to 0000-00-00 in the update view, and I don’t even have anything in the model or controller that sets that default value…
Hello guys. It seems that CJuiDatePicker works wrong.
I used CRUD generator in order to generate controller and view. Then I changed
$form->textField($model,'date_start');
to
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name'=>'date_start',
'model'=>$model,
'attribute'=>'date_start',
'value'=>$model->date_start,
// additional javascript options for the date picker plugin
'options'=>array(
'showAnim'=>'fold',
'dateFormat'=>'yy-mm-dd'
),
'htmlOptions'=>array(
'style'=>'height:20px;',
),
));
But when I choose date and press submit, form’s validator shown me error message: “Date Start cannot be blank.” And I decided to check the “value” attribute of input field which used by zii.widgets.jui.CJuiDatePicker, and it was empty. Even more it was absent. Btw I use Yii 1.1.6.