CHtml::dropDownList() and name attribute

Why can’t I pass a name attribute in $htmlOptions array of the CHtml::dropDownList() method? Looking through the source code of the dropDownList() method, I see that $htmlOptions[‘name’] gets overwritten and is ignored. I understand this as a bug. It should first check for the existence of $htmlOptions[‘name’] and in case it does not exist, then set it.

Opened issue 1947.

My mistake. Now, I understand what I did wrong.

Sorry to disturb, I am new in yii, how to set $htmlOptions[‘name’]?

I am facing the same issue and I can’t find the answer. It would have been useful to see “what you did wrong” because perhaps we are doing the same and we can’t see it.

Just to be clear: I don’t want the ‘name’ to be the label of my DropDown list becaue it will be visible to the web user. I want them to see the label, not the dropdownlist name. One thing is the ‘name’ I am including in the $_POST and another the label to be displayed. Therefore, I can’t use CHtml::Dropdownlist and have to revert to traditional HTML, which is not a prob. Yii is still FANTASTIC.