yii -> dropDownList -> CHtml::listData -> set selected value

后端 未结 1 492
旧巷少年郎
旧巷少年郎 2021-01-24 13:36

How can I set the selected value in the following statement:

echo $form->dropDownList(
    $model,
    \'land_id\',
    CHtml::listData(ListeLand::model()->         


        
1条回答
  •  -上瘾入骨i
    2021-01-24 13:59

    this works..

    echo $form->dropDownList(
        $model,
        'land_id',
        CHtml::listData(ListeLand::model()->findAll(), 'iso', 'landname'),
        array(
                    'class'=>'span4 chosen',
                    'maxlength'=>20,
                    'options' => array('AT'=>array('selected'=>true)),
        )
    );
    

    0 讨论(0)
提交回复
热议问题