提交后,CJuiDatePicker在文本字段中保留值

I have a search module where user picks Date in a CJuiDatePicker. when i click submit, the page will load but the dates in my datepicker will disappear. How can i retain the values in my field? The searching of the values are fine. It is returning the correct data. But the values in the fields are gone. Can someone help.?

i have this in my form.

<div class="panel-body">
    <?php
        $form = $this->beginWidget( 'CActiveForm', 
            array(      'id' => 'search-form', 
                        'action' => array('index'), 
                        'enableAjaxValidation'=>true,
                        'enableClientValidation' => true, 
                        'clientOptions' => array('validateOnSubmit' => true), 
                        'htmlOptions' => array(
                            'class' => 'form-horizontal', 
                            'onsubmit' => '
                                return  !(document.getElementById(\'to\').disabled) && 
                                        !(document.getElementById(\'from\').value == \'\') && 
                                        !(document.getElementById(\'to\').value == \'\');'
            ))
        );
    ?> 
    <form>
        <div class="form-group"><label>Date From</label>
            <?php 
                $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                    'model' => $model,  
                    'name' => 'start_date',
                    'options'=>array(
                        'dateFormat'=>'yy-mm-dd',
                    ),
                    'htmlOptions'=>array(
                        'class'=>'form-control',
                        'placeholder'=>'From',
                        'value' => $search_date_start,
                    ),
                ));  
            ?> 
        </div> 

        <div class="form-group"><label>To</label>
            <div class="controls" style='margin-top: 5px;'>
                <?php 
                $end_date = date('m-d-Y');
                    $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                        'model' => $model,  
                        'name' => 'end_date',
                        'options'=>array(
                            'dateFormat'=>'yy-mm-dd',
                        ),
                        'htmlOptions'=>array(
                            'class'=>'form-control',
                            'placeholder'=>'To',
                            'value' => $search_date_end,
                        ),
                    ));  
                ?>
            </div>
        </div>

        <div class="form-group"> <label>Employee Name</label>
            <div class="controls" style='margin-top: 5px;'>
                <?php
                    $form->widget('zii.widgets.jui.CJuiAutoComplete', array('name' => 'search',
                        'source' => Evaluation::searchEvaluation(),
                        'htmlOptions' => array('class' => 'form-control', 'placeholder' => 'Search'),
                        'options' => array(
                        ),
                        'value' => $search,
                    ));
                ?>  
            </div>
        </div>

        <div class="form-group">
            <input type="submit" name='search_btn' value="Search" class='btn btn-primary '>
            <input type="submit" name='reset_btn' value="Reset" class='btn btn-default '> 
        </div>
    </form>
    <?php $this->endWidget();?>
</div>

this is my controller code:

class EvaluationController extends Controller {

    public function actionIndex()
    { 
        Helper_Site::initializePage();
        LoginForm::checkLogin();
        $user = LoginForm::getUser();

        if($user->username == $user->company_id){
            Yii::app()->getController()->redirect(array("site/initiallogin"));
        }else{
            $model = new EvaluationDetails('search');
            $model->unsetAttributes();  // clear any default values
            if (isset($_GET['EvaluationDetails'])) {
                $model->attributes = $_GET['EvaluationDetails'];
            }

            $modelE = new Evaluation('search');
            $modelE->unsetAttributes();  // clear any default values
            if (isset($_GET['Evaluation'])) {
                $modelE->attributes = $_GET['Evaluation'];
            }

            //start here
            $search = '';

            //SEARCH BTN
            if(isset($_POST['search_btn'])) {
                if (isset($_POST['start_date'])) {
                    $search = $_POST['search'];
                    Yii::app()->session['search_evaluation'] = $search;
                    $search_date_start = '';
                    $search_date_end = '';
                } else {
                    if (isset($_POST['start_date']) && isset($_POST['end_date'])) {
                    $search_date_start = $_POST['start_date'];
                    $search_date_end = $_POST['end_date'];
                    Yii::app()->session['start_date_evaluation'] = $search_date_start;
                    Yii::app()->session['end_date_evaluation'] = $search_date_end;
                } else {
                    var_dump("no start_date and no end_date passed");
                    if (count(Evaluation::model()->findAll()) == 0) {
                        $search_date_start = date('Y-m-d', strtotime("-1 month"));
                        $search_date_end = date('Y-m-d');

                    } else {
                        $criteria = new CDbCriteria();
                        $criteria->order = "start_date ASC";
                        $search_date_start = date("Y-m-d", strtotime(Evaluation::model()->find($criteria)->start_date));
                        $criteria->order = "end_date DESC";
                        $search_date_end = date("Y-m-d", strtotime(Evaluation::model()->find($criteria)->start_date));

                    }
                }

                /*if (isset($_POST['search'])) {
                    $search = $_POST['search'];
                    Yii::app()->session['search_evaluation'] = $search;
                }*/
                }
            }// RESET BTN
            else if (isset($_POST['reset_btn'])) {
            unset(Yii::app()->session['start_date_evaluation']);
            unset(Yii::app()->session['end_date_evaluation']);
            unset(Yii::app()->session['search_evaluation']);

            $search_date_start = date('Y-m-d', strtotime("-1 month"));
            $search_date_end = date('Y-m-d');
            } else {
            if (isset(Yii::app()->session['start_date_evaluation']) && isset(Yii::app()->session['end_date_evaluation'])) {
                $search_date_start = Yii::app()->session['start_date_evaluation'];
                $search_date_end = Yii::app()->session['end_date_evaluation'];

                if (isset(Yii::app()->session['search_evaluation'])) {
                    $search = Yii::app()->session['search_evaluation'];

                }
            } else {
                unset(Yii::app()->session['start_date_evaluation']);
                unset(Yii::app()->session['end_date_evaluation']);
                unset(Yii::app()->session['search_evaluation']);

                $search_date_start = date('Y-m-d', strtotime("-1 month"));
                $search_date_end = date('Y-m-d');
            } 
        }   //end here

            $this->render('index', array('model' => $model, 'modelE' => $modelE, 'search_date_start' => $search_date_start, 'search_date_end' => $search_date_end, 'search' => $search));
        }
    }

When use param model with widgets don't set values this way:

$this->widget('zii.widgets.jui.CJuiDatePicker', array(
    'model' => $model,
    'attribute' => 'start_date',
    'htmlOptions' => array(
        'value' => $search_date_start
    )
));

Do it in model (better way) or controller.

Controller's short example:

if (isset($_POST['EvaluationDetails'])) {
    $model->attributes = $_POST['EvaluationDetails']; // specify model scenario and rules() to set only needed params
} else {
    $model->start_date = date('Y-m-d', strtotime("-1 month"));
}

Also you check $_POST['start_date'] for value. As you specify model param to CJuiDatePicker, you should consider also a model name $_POST['EvaluationDetails']['start_date'].