Many users face problems regarding the dependent dropdown list But yii make this easy to use ajax in you application where you want , Today i am going to explain a very simple and handy way to add dependent dropdown list in your application .
Step 1) Add a form in your view .

<?php 
$model=new ModelClass; // initilize it in controller
$form=$this->beginWidget('CActiveForm', array(
'id'=>'dependent-form',
'enableClientValidation'=>true,
'htmlOptions' => array('enctype' => 'multipart/form-data','autocomplete'=>'off'),
'clientOptions'=>array(
'validateOnSubmit'=>true,
)
)); 
?>
<div class="row">
<?php                                   
echo $form->dropDownList($model,'country_id', 
CHtml::listData(Countries::model()->findAll(), 'id', 'title'),
array(
'prompt'=>'Select Country',
'ajax' => array(
'type'=>'POST', 
'url'=>Yii::app()->createUrl('YourController/loadstates'), //  get states list
'update'=>'#ModelClass_state_id', // add the state dropdown id
'data'=>array('country_id'=>'js:this.value'),
))); 
?>  
</div>
<div class="row">
<?php                                   
echo $form->dropDownList($model,'state_id', 
array(),
array(
'prompt'=>'Select State',
'ajax' => array(
'type'=>'POST', 
'url'=>Yii::app()->createUrl('YourController/loadcities'), //  get states list
'update'=>'#ModelClass_city_id', // add the state dropdown id
'data'=>array('state_id'=>'js:this.value'),
))); 
?>  
</div>
<div class="row">
<?php                                   
echo $form->dropDownList($model,'city_id',array(),array('empty'=>'-choose city-')); 
?>  
</div>
<?php echo CHtml::submitButton($model->isNewRecord ? 'Add' : 'Update',array('class'=>'btn btn-primary')); ?>
<?php $this->endWidget(); ?>

Step 2 Create methods in your controller file .

// get states
public function actionLoadstates()
{
$data=States::model()->findAll('country_id=:country_id', 
array(':country_id'=>(int) $_POST['country_id']));
$data=CHtml::listData($data,'id','title');
echo "<option value=''>Select City</option>";
foreach($data as $value=>$statename)
echo CHtml::tag('option', array('value'=>$value),CHtml::encode($statename),true);
}
// get cities function 
public function actionLoadcities()
{
$data=Cities::model()->findAll('state_id=:state_id', 
array(':state_id'=>(int) $_POST['state_id']));
$data=CHtml::listData($data,'id','title');
echo "<option value=''>Select City</option>";
foreach($data as $value=>$cityname)
echo CHtml::tag('option', array('value'=>$value),CHtml::encode($cityname),true);
}
http://codingbin.com/wp-content/uploads/2016/05/Responsive-Country-state-city.pnghttp://codingbin.com/wp-content/uploads/2016/05/Responsive-Country-state-city-150x150.pngdevidframeworksYiidropdown,php,yiiMany users face problems regarding the dependent dropdown list But yii make this easy to use ajax in you application where you want , Today i am going to explain a very simple and handy way to add dependent dropdown list in your application . Step 1) Add a...coding, php, wordpress, yii, cakephp, and  jquery

Are you want to get implementation help, or modify or extend the functionality of this script? Submit paid service request