Create a Drop Down for non related class

hi, how to create a select drop down box for a field which has no relation defined in "relations" method.

[color="#006400"]/* moved topic from Yii 1.0 to Yii 1.1 help forum */[/color]

Hi praveen,

can you please explain a bit more about your question.

Since a Drop down is a simple select box.and its depends on you that how you want to use it.


" which has no relation defined in "relations" method."

explain a bit more about it…

Hi jayanth,

thanks for the reply… i wanted to create a drop down select box for a model, but my db table did not have a the field for the same, hence no relation, it showed an error property not defined. But later i figured out that i had to declare that field as public variable in that model class. so it worked… not sure whether it was right thing to do. :)

Well first of all my name is Jayant not jayanth ;)

And yes you are doing right.if a model attribute is not define in the database table then you can define it in model class a public variable.and use that attribute. :)

Hi Jayant,

Haha… Sorry for the typo… Thanks a lot… :)

Your welcome…:)