douyi9447 2012-09-11 02:10
浏览 15

yii输入在空值时获得焦点

<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(
    'id'=>'user-form',
    'enableAjaxValidation'=>false,
)); ?>
    <?php echo $form->textFieldRow($model,'username',array('class'=>'span5','maxlength'=>20,'value'=>'input username')); ?>

<?php $this->endWidget(); ?>

Yii provides built-in methods? Still have to write it yourself?

  • 写回答

1条回答 默认 最新

  • dongque1958 2012-09-11 08:24
    关注

    Could it be that you mean the "placeholder" attribute instead of "value"?

    <?php echo $form->textFieldRow($model,'username',
          array(
            'class'=>'span5',
            'maxlength'=>20,
            'placeholder'=>'input username'  // <- use this
          )); ?>
    
    评论

报告相同问题?