我使用clevertech扩展YII,任何人都知道如何在输入中添加我自己的自定义占位符文本。 以下是输入字段的示例:
<?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.'
)
); ?>
答案 0 :(得分:2)
您可以将placeholder
添加到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',
),
),
)
); ?>
请参阅http://yiibooster.clevertech.biz/widgets/forms/view/activeform.html
答案 1 :(得分:0)
试试这个......
<?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.'
)
); ?>