不可编辑的文字栏位 [英] Non-Editable Text-Field

查看:94
本文介绍了不可编辑的文字栏位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是YII中的新手,我想知道YII中的文本字段是否可以设为不可编辑.如果是这样,任何人都可以回答. 我按以下方式进行.

I am new in YII, i am wondering if the text-field in YII can made non-editable. If so can anyone answer. I do the following way..

<?php echo $form->labelEx($model,'first_name'); ?>
    <?php echo $form->textField($model,'first_name',array('setEnabled' => false)); ?>

这不起作用.

推荐答案

使用 代替:

<?php echo $form->textField($model,'first_name',array('readonly' => true)); ?>


不闪烁,请使用 disabled属性:


For no blinking, go for disabled attribute:

<?php echo $form->textField($model,'first_name',array('disabled' => true)); ?>


两者的行为都不同,因此请务必检查一下.


Both behave differently so be sure to check that out.

这篇关于不可编辑的文字栏位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆