Just Learned

First should declare two variables in model




public $from_date,$to_date;



Then add following lines in the search function [model]




if(!empty($this->to_date) && !empty($this->from_date))

{

$criteria->condition = "dat  between '$this->from_date' and  '$this->to_date'";

}




The following lines need in the view file to display form




<div id="search">


$this->beginWidget('zii.widgets.CPortlet', array(


'title'=>"Search",


));


<?php 


$form=$this->beginWidget('CActiveForm', array( 'id'=>'page-form',                                                                   	                                                            	'enableAjaxValidation'=>true,)); 


?>

																			

	<b>From :</b>


	<?php


$this->widget('zii.widgets.jui.CJuiDatePicker', array(


       'name'=>'from_date',  // name of post parameter


					'value'=> '',//Yii::app()->request->cookies['from_date']->value,


		     'options'=>array(


					  	'showAnim'=>'fold',


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

					),'htmlOptions'=>array(

				       'style'=>'height:20px;'

				       ),

				       ));


     ?>


<br /><b>To :</b>


  	<?php


     $this->widget('zii.widgets.jui.CJuiDatePicker', array(


		'name'=>'to_date',


				     'value'=> '',//Yii::app()->request->cookies['to_date']->value,


					'options'=>array(


								     'showAnim'=>'fold',


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

								  	),


				     'htmlOptions'=>array('style'=>'height:20px;),));


       ?>


  <?php echo CHtml::submitButton('Search',array('id'=>'searchbtn')); ?>


     [b]<?php $this->endWidget(); ?>[/b]


<?php $this->endWidget();?>

                         	


</div>




Finally add following lines in the controller/admin function




if(!empty($_POST))

{


$model->from_date = $_POST['from_date'];


$model->to_date = $_POST['to_date'];


}



Thats it!

[color="#006400"]/* Moved from "General Discussion for Yii 1.1.x" to "Tips, Snippets and Tutorials" */[/color]

Would you please revise the post to make your code more readable?

sorry for the delay. now code has been reformatted for ease of reading.