Ajax Reload On Dropdownmenu Click

Hey guys,

what I wanna do is to have a page with a Dropdownlist. When a user clicks on a menu entry the next step (also a dropdownmenu) shall be visible (later on there shall be a dependance but right now I ONLY want to DISPLAY the other dropdown menu when the user clicked an entry in the first one).

So that’s my code in the view:

echo CHtml::dropDownList('cat0_name','',$list,


        'prompt'=>'Kategorie wählen',

        'ajax' => array(




            'data'=>array('id'=>'js:this.value', 'step' => 1),


echo CHtml::dropDownList('cat1_name','', array(), array('style'=>'display:none;','prompt'=>'Select Stuff'));

echo CHtml::dropDownList('cat2_name','', array(), array('style'=>'display:none;','prompt'=>'Select Stuff'));

What I’ve tried to do is to replace a dropdownlist with invisible style with a dropdownlist that has my content.

The controller code:

   public function actionLoadcities()



            array(':id'=>(int) $_POST['id']));


        $models = CnfCategory::model()->findAll();

        $data = CHtml::listData($models,

            'id', 'plural');

        $step = $_POST['step'];


        echo CHtml::dropDownList('cat'.$step.'_name','',$data,


                'prompt'=>'Kategorie wählen ',

                'ajax' => array(




                    'data'=>array('id'=>'js:this.value', 'step' => $step+1),



What is going wrong here? When I try to do this and inspect the page with firebug no request is called after I click on an entry in the second dropdown menu. If I set the step to 0 (which i commented here) there is at least a post request but nothing happens :( that’s very weird.

I hope some of you can help me with this!! :) Even if you know a better method how to do that I would really like to know what’s the problem here.

Or if nobody knows what’s wrong there: what alternative solution is there for having a dropdown menu which displays elements on click? How would you have implemented it?

I would be really thankful for an answer :mellow: