Populating dropdown list with another dropdown list

Hi all,

Please i have been having challenges getting this done.

I have a dropdown A (A- list data from a model ‘CompetencyType’. Each competency type has sub category) .

Now my problem is that, I want to populate dropdown B(with Sub_category) using the selected item from dropdownA.

Please what am i doing wrong? I have tried all i could but seems not working.

This is my View

<div class="row">

	&lt;?php echo &#036;form-&gt;labelEx(&#036;model,'competency_type'); ?&gt;

	&lt;?php echo &#036;form-&gt;dropDownList(&#036;model,'competency_type', CHtml::listData(competencyType::model()-&gt;findAll(array('order'=&gt;'competency_type')), 'competency_type', 'competency_type'),


                            'ajax' =&gt; array(



                            'update'=&gt;'#'.CHtml::activeId(&#036;model,'sub_name')))); ?&gt;


	&lt;?php echo &#036;form-&gt;error(&#036;model,'competency_type'); ?&gt;



<?php echo CHtml::dropDownList(‘sub_name’,’’, array() ); ?>

This is my Controller

public function actionGetType()


        &#036;competency_type = &#036;_POST['CompetencyManager']['competency_type'];


         array(':competency_type'=&gt; &#036;competency_type));


          foreach(&#036;data as &#036;value=&gt;&#036;subname)


                echo CHtml::tag('option',




check letter case. actionGetType() is called with URL: controller/getType, not controller/GetType

Thanks redguy. I changed my ajax post call to controller/getType, still not working

have you tried to use firebug to see background ajax request and response?

I tried fire bug but i could not locate any error

  1. is there any AJAx request at all?

  2. check what parameters (GET and POST) is it carying?

  3. what is the server response (status code, response text)?

  4. are there any JS errors during page loading or Ajax request?