the idea is the same as datePicker but its generating data from database rather than date.
to get this DataPicker working in the form you'll need CJuiDialog and CGridView.
maybe the picture below will helps you to understand the idea a little bit.

First of all you'll need to use CJuiDialog in your form and see how it works
and then added CGridView in your form.
open _form.php and modified a field a little bit.
labelEx($model,'id_pendaftar'); ?> hiddenField($model,'id_pendaftar'); ?> < input type="text" name="nama_pendaftar" id="nama_pendaftar" readonly value="findByPk($model->id_pendaftar)->nama_pemohon ?>"> 'del_pendaftar', 'id' => 'del_pendaftar', 'onclick' => '$("#nama_pendaftar").val("");$("#Izin_id_pendaftar").val("")')) ?> beginWidget('zii.widgets.jui.CJuiDialog', array( 'id'=>'pendaftar_dialog', // additional javascript options for the dialog plugin 'options'=>array( 'title'=>'List Pendaftar', 'width'=>'auto', 'autoOpen'=>false, ), )); /* Youll put CGridView Here */ $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'pendaftaran-grid', 'dataProvider'=>$pendaftaran_model->search(), 'filter'=>$pendaftaran_model, 'columns'=>array( 'no_daftar', array( 'header'=>'Tanggal Pendaftaran', 'name'=>'tgl_daftar', ), 'nama_pemohon', 'alamat_pemohon', 'nama_perusahaan', array( 'header'=>'', 'type'=>'raw', /* Here is The Button that will send the Data to The MAIN FORM */ 'value'=>'CHtml::Button("+", array("name" => "send_pendaftar", "id" => "send_pendaftar", "onClick" => "$(\"#pendaftar_dialog\").dialog(\"close\"); $(\"#nama_pendaftar\").val(\"$data->nama_pemohon\"); $(\"#Izin_id_pendaftar\").val(\"$data->id\");"))', ), ), )); $this->endWidget('zii.widgets.jui.CJuiDialog'); echo CHtml::Button('Get Pendaftar', array('onclick'=>'$("#pendaftar_dialog").dialog("open"); return false;', )) error($model,'id_pendaftar'); ?>
Youll Need to Modified the method in the Controller that is actionCreate and actionUpdate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
/* Data That will be loaded into CGridView */
/* actually this was just a simple COPY PASTE from actionAdmin controller */
/* DONT FORGET TO copy paste this into actionUpdate controller */
$pendaftaran_model=new Pendaftaran('search');
$pendaftaran_model->unsetAttributes(); // clear any default values
if(isset($_GET['Pendaftaran']))
$pendaftaran_model->attributes=$_GET['Pendaftaran'];
/* this Code is Default Code to Create Data you don't have to change this */
$model=new Izin;
if(isset($_POST['Izin']))
{
$model->attributes=$_POST['Izin'];
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('create',array(
'model'=>$model,
/* DONT FORGET TO RENDER THE DATA PROVIDER INTO VARIABLE THAT WILL BE LOADED INTO CGRIDVIEW */
'pendaftaran_model'=>$pendaftaran_model,
));
}
After this you have to Modified a little bit in the create.php and update.php.
create.php and update.php is located at View folder
renderPartial('_form',
array('model'=>$model,
/* DONT FORGET TO DO THIS OR NO DATA PROVIDER WILL BE LOADED */
'pendaftaran_model'=>$pendaftaran_model
));
?>
Done now you'll have a Data Picker.
im sorry for the messy code and my bad english.















