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?

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
      )); ?>