Ajax dropdownlist

Hy, why dont return this dropdownlist null?


        public function actionAjaxtelepules() {

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

                $megye = $_GET['megye'];

                $model = new Hirdetes;

                $varosok = Hirdetes::model()->find(

                            array(

                                "select"=>"telepules",

                                "condition"=>"megye=:megyeID",

                                "params"=>array(":megyeID"=>$megye),

                            )

                        );

                $valasz = CHtml::listData($varosok,'telepules','telepules');

                $prompt = array('prompt'=>Yii::t('layout','Please select')); 

                echo CHtml::dropDownList($varosok,'telepules', $valasz, $prompt);

                //var_dump($varosok);

            }

        }

The $varosok show all telepules item, but the $valasz is null.

Have you tried without the select?




                $varosok = Hirdetes::model()->find(

                            array(

                                "condition"=>"megye=:megyeID",

                                "params"=>array(":megyeID"=>$megye),

                            )

                        );



Edit:

I think you should use [font="Courier New"]findAll[/font] in order to build a list, and not [font="Courier New"]find[/font], which returns one item (the first that matches the criteria).

The findAll it works, thx. :)