GSTAR
(Omzy83)
December 11, 2009, 12:40pm
1
Can’t seem to figure this one out. I want to generate an array to be used by dropDownList. The data is in a table called ‘locations’, in a field called ‘loc_name’.
I want to generate an array with each row from this table, as follows:
return array(
Location::model()->loc_name => Location::model()->loc_name,
);
Ricardo
(Piotr Komorek)
December 11, 2009, 12:53pm
2
mbi
(mbi)
December 11, 2009, 1:08pm
3
Can’t seem to figure this one out. I want to generate an array to be used by dropDownList. The data is in a table called ‘locations’, in a field called ‘loc_name’.
I want to generate an array with each row from this table, as follows:
return array(
Location::model()->loc_name => Location::model()->loc_name,
);
echo CHtml::activeDropDownList($model, 'loc_name', CHtml::listData(Location::model()->findAll(), 'loc_name', 'loc_name'));
GSTAR
(Omzy83)
December 11, 2009, 1:50pm
4
Cheers mbi.
Is it possible to do this in a function, that I can put inside the Property model?
I want to be able to generate the dropDownList like this:
<?php echo CHtml::dropDownList('location', $_GET['location'], Property::model()->getLocations()); ?>