I have implemented a dependent dropdown in my yii app. It works out fine, but what I want is instead of showing the index no. of an array, I want to show its actual value. Just need a suggestion because I am really a newbie here. Thank you.
Sorry Mr. Right, Not so right this time. CListData returns an associative array with, in the case of models, the first attribute as the index the second as the value. When dropDownList creates the ‘dropdown’ it will generate the option tag as:<option value=“index”>value</option>.
Maybe this is better: given $ary=array(0=>‘Red’, 1=>‘Blue’, 3=>‘Green’);
Red Blue Green should be displayed in the dropdown and ‘value’ is returned on the form.
As for OP: I’m not sure why your not getting numbers and not the words. I would ask why you need to call ajax to get the list? But just looking at the code you posted, I don’t think the ajax call is actually returning anything but I haven’t used ajax much.