Yii ::dependable 2 Text Filed With Cjuiautocomplete

Dear All,

I am using yii CJuiAutocomplete for my form. I have two filed.

  1. first filed using for CJuiAutocomplete to get cm_code by typing something

  2. 2nd one will be depend on first one. after filling the 1st textfield the 2nd field show dropdown list according to 1st field.

Form View

====




<div class="row" >

		<?php echo $form->labelEx($model, 'cm_code'); ?>

			<?php $this->widget('zii.widgets.jui.CJuiAutoComplete', array(

		        'name'=>'cm_name',

				'id' =>'selectid',

				'model'=>$model, //Model object

				'attribute'=>'cm_code', //attribute name

		        'sourceUrl' => Yii::app()->createUrl('requisitiondt/Acomplete', array('pp_unit'=>"function() { $('#Ad_pp_unit').val();}")),

				//'source' => array_keys(CHtml::listData(Productmaster::model()->findAll(array('select' => 'cm_code')), 'cm_name', 'cm_code')),


		        'options'=>array(

		            'minLength'=>'1',

					'showAnim'=>'fold',

		        ),

		 

		        'htmlOptions'=>array(

		            'class'=>'input-1',

		          	'onblur' => "myFunction()",

		        ),

		    )); ?>


		<?php echo $form->error($model,'cm_code'); ?>

	</div>


	<div class="row">

		<?php echo $form->labelEx($model,'pp_unit'); ?>

		<?php echo $form->dropDownList($model,'pp_unit', array() );?>

		<?php echo $form->error($model,'pp_unit'); ?>

	</div>



Controller

====


public function actionAcomplete(){

		

			$res =array();


			if (isset($_GET['term'])) {

				

				$qtxt ="SELECT Concat(cm_code,'-',cm_name) FROM cm_productmaster WHERE cm_name LIKE :txt";

				$command =Yii::app()->db->createCommand($qtxt);

				$command->bindValue(":txt", '%'.$_GET['term'].'%', PDO::PARAM_STR);

				$res =$command->queryColumn();

				

			}


			echo CJSON::encode($res);

			Yii::app()->end();

			}



What I want

====

I want a dropdown list according to CJuiAutocomplete 1st text field is like search field. When I will type something it shows a list of data. After selecting data from 1st field I want to show dropdown list into 2nd filed.

** I need to show dropdownlist in 2nd field. I am new in yii. I do not know how can I do that. Please help me out **