I have a question related to Yii DropDownList. How can we give some attribute values to each option. For Example I need to build a dropdownlist looks like below.
<select>
<option value="a" myAttribute="xyz">Calendar</option>
<option value="n" myAttribute="PQR">Shopping Cart</option>
<option value="c" myAttribute="ABC">CD</option>
<option value="d" myAttribute="HMN">Email</option>
</select>
values and myAttributes's value are coming from table. How can I implement this by altering the following?
<?php echo $form->dropDownList($model,'media_ids',Media::getAllmedia(),array('?'=>'?')); ?>
in model Media I have function like this
public function getAllmedia() {
$condition = 'isActive = "Y"';
$model = Media::model()->findAll(array('condition' => $condition));
return CHtml::listData($model, 'id', 'media_title');
}
EDIT: My Requirement is to show images along with each option, for that i have to give another attribute to each option which holds the image path