Codxplore.com

Latest news: New android application Islamic Video has been released. its a free islamic video application for android smartphone. Download now!


Using below code we can create the list box base on model attribute of yii2.0 framework. We added the following options like prompt, size, disabled, style etc


field($model, 'population')-> listBox(
            array('1'=>'1',2=>'2',3=>3,4=>4,5=>5),
            array('prompt'=>'Select')
            ); ?>

field($model, 'population')-> listBox(
            array('1'=>'1',2=>'2',3=>3,4=>4,5=>5),
            array('prompt'=>'Select','size'=>3)
            ); ?>

field($model, 'population')-> listBox(
            array('1'=>'1',2=>'2',3=>3,4=>4,5=>5),
            array('disabled' => true,'style'=>'background:gray;color:#fff;'))
            ->label('Gender'); ?>

Tags :

Views : 1265

Subscribe Us


Follow Us