如何将占位符文本添加到yii输入字段?
我正在使用clevertech作为YII的扩展,有人知道我如何在输入中添加自己的自定义占位符文本吗。 以下是输入字段的示例:如何将占位符文本添加到yii输入字段?,yii,yii-extensions,Yii,Yii Extensions,我正在使用clevertech作为YII的扩展,有人知道我如何在输入中添加自己的自定义占位符文本吗。 以下是输入字段的示例: <?php echo $form->textFieldGroup( $model, 'textField', array( 'wrapperHtmlOptions' => array( 'class' =>
<?php echo $form->textFieldGroup(
$model,
'textField',
array(
'wrapperHtmlOptions' => array(
'class' => 'col-sm-5',
),
'hint' => 'In addition to freeform text, any HTML5 text-based input appears like so.'
)
); ?>
您可以向html属性添加
占位符,如下所示:
<?php echo $form->textFieldGroup(
$model,
'textField',
array(
'wrapperHtmlOptions' => array(
'class' => 'col-sm-5',
),
'hint' => 'In addition to freeform text, any HTML5 text-based input appears like so.',
'widgetOptions' => array(
'options' => array(
'placeholder' => 'Placeholder content',
),
),
)
); ?>
请参见试试这个
<?php echo $form->textFieldGroup(
$model,
'textField',
array(
'wrapperHtmlOptions' => array(
'class' => 'col-sm-5',
),
'widgetOptions'=>array(
'htmlOptions'=>array('placeholder' => 'Placeholder content')
)
'hint' => 'In addition to freeform text, any HTML5 text-based input appears like so.'
)
); ?>
它对我不起作用,它采用LabelsI下模型中的默认参数。我根据文档更新了我的示例,你能再试一次吗?