Saving Data From Yii Widget

I am using a CJUIDatePicker widget in one of my Yii Forms generated through GII in order to simply the users data entry aspect. However it only enters 00:00:00 into the database.

In my view file,

<?php

&#036;this-&gt;widget('zii.widgets.jui.CJuiDatePicker', array(


'model'=&gt;&#036;model,


'attribute'=&gt;'purchaseDate',


 ));

?>

In the controller actionCreate,

$model=new Patient_meals;

if(isset($_POST[‘Patient_meals’])){

    &#036;model-&gt;attributes=&#036;_POST['Patient_meals'];


if(&#036;model-&gt;save())


	&#036;this-&gt;redirect(array('view','id'=&gt;&#036;model-&gt;patientId));

}

$this->render(‘create’,array(‘model’=>$model,));

I also used an autocomplete widget in another form using CJUIAutoComplete, but when I submit the records it mentions that addressCity cannot be blank, despite it being filled

$this->widget(‘zii.widgets.jui.CJuiAutoComplete’,array(

'name'=&gt;'addressCity',


	'source'=&gt;array('A','B','C','D','E'),


)); 

In the actionCreate method

$model=new Patient_details;

if(isset($_POST[‘Patient_details’])){

&#036;model-&gt;attributes=&#036;_POST['Patient_details'];


if(&#036;model-&gt;save())


	&#036;this-&gt;redirect(array('view','id'=&gt;&#036;model-&gt;patientId));


}


&#036;this-&gt;render('create',array('model'=&gt;&#036;model,));

Any ideas on how this could be fixed

I think date format will create problem.datebase date format is "YY-mm-dd" . Just Try this code in date picker




              'options'=>array(

                    'dateFormat' => 'yy-mm-dd',

                ),



Thanks, the date picker works correctly now. However did you have time to check on the CJUIAutoComplete widget

add model to CJuiAutocomplete




'model'=>$modelname