Skip to content Skip to sidebar Skip to footer

Change The Priority Of Selected Attribute In Listbox

Following is the example code : IN CONTROLLER foreach($UserTypesArray as $key => $value) { $model->allowed_users[$key] = ['selected' => 'selected']; } $

Solution 1:

There is a bug in yii itself I found on one of the yii forums. So I would like to share with you guys.

If you write it like that

['selected' => 'selected'];

It wont work.

But If you write it like that

['selected ' => 'selected']; or true

consider the space after selected. ['selected ' If you just put a space after selected it works perfectly.

Don't know why this is. But it works.

Post a Comment for "Change The Priority Of Selected Attribute In Listbox"