/**
  * Lists all models.
  */
 public function actionIndex()
 {
     parent::actionIndex();
     $plant = new Plant('searchwstatus');
     $plant->unsetAttributes();
     // clear any default values
     if (isset($_GET['Plant'])) {
         $plant->attributes = $_GET['Plant'];
     }
     $model = new Sloc('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Sloc'])) {
         $model->attributes = $_GET['Sloc'];
     }
     if (isset($_GET['pageSize'])) {
         Yii::app()->user->setState('pageSize', (int) $_GET['pageSize']);
         unset($_GET['pageSize']);
         // would interfere with pager and repetitive page size change
     }
     $this->render('index', array('model' => $model, 'plant' => $plant));
 }
<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'project-form', 'enableAjaxValidation' => false));
$this->widget('ToolbarButton', array('DialogID' => 'createdialog3', 'DialogGrid' => 'detailpurchasedatagrid', 'isSave' => true, 'UrlSave' => 'product/writepurchase', 'isCancel' => true, 'UrlCancel' => 'product/cancelwritepurchase'));
echo $form->hiddenField($model, 'productpurchaseid');
echo $form->hiddenField($model, 'productid');
?>
	<div class="row">
		<?php 
echo $form->labelEx($model, 'plantid');
echo $form->hiddenField($model, 'plantid');
?>
          <input type="text" name="plantcode" id="plantcode" readonly >
          <?php 
$this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'plant_dialog', 'options' => array('title' => Yii::t('app', 'Plant'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true)));
$plant = new Plant('searchwstatus');
$plant->unsetAttributes();
// clear any default values
if (isset($_GET['Plant'])) {
    $plant->attributes = $_GET['Plant'];
}
$this->widget('zii.widgets.grid.CGridView', array('id' => 'plant-grid', 'dataProvider' => $plant->Searchwstatus(), 'filter' => $plant, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("V",
                array("name" => "send_addresstype",
                "id" => "send_addresstype",
                "onClick" => "$(\\"#plant_dialog\\").dialog(\\"close\\"); 
                $(\\"#plantcode\\").val(\\"$data->plantcode\\");
                $(\\"#Productpurchase_plantid\\").val(\\"$data->plantid\\");"))'), array('name' => 'plantid', 'visible' => false, 'value' => '$data->plantid', 'htmlOptions' => array('width' => '1%')), 'plantcode')));
$this->endWidget('zii.widgets.jui.CJuiDialog');
echo CHtml::Button('...', array('onclick' => '$("#plant_dialog").dialog("open"); return false;'));
?>
		<?php 
echo $form->error($model, 'plantid');