Yii $form->textfield, how to set a default value?

后端 未结 7 780
孤独总比滥情好
孤独总比滥情好 2021-02-12 10:55

So I am fiddling with the Yii Framework and in one of the views, specifically the create form, I am trying to give one of my textfields a default value. Therefore when I go onto

7条回答
  •  一向
    一向 (楼主)
    2021-02-12 11:50

    labelEx($model,'teamlead'); ?> textField($model,'teamlead',array('readonly'=>'true',size'=>50,'maxlength'=>50,'value'=>Yii::app()->user->getUsername(),'disabled'=>'disabled')); ?> error($model,'teamlead'); ?>

    put array('readonly'=>'true') in your coding it will work

提交回复
热议问题