Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Dropdownlist

$
0
0
I came across the following problem.

I intended to use the CActiveForm.dropDownList() method
in a form where I'm collecting user data.

echo $form->dropDownList($myModel,'SearchDeadline',$some_list);


As stated in the reference guide , the first parameter of dropDownList()
should be the data model.

Beeing unaware , I used something like this :

$myModel=MyModel::model()->findAll('ID=:ID',array(':ID'=>'55'));


Unfortunatelly , I got the error : get_class() expects parameter 1 to be object, array given

OK , I see , findAll() , returns an array and dropDownList is expecting a CModel class.

How else could I retrieve data from the model ?
Is there an alternative to findAll , which returns a Cmodel class ?
I'm stuck. :unsure:

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>