2015-08-31 55 views
1

iam使用clevertech擴展YII,劑量任何人都知道我可以在輸入內添加我自己的自定義佔位符文本。 下面是提交的輸入的例子:如何將佔位符文本添加到yii inputfield?

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

回答

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

+0

它不適合我,它需要默認的parm在m odel根據標籤 – Gunnit

+0

我根據文檔更新了我的示例,您可以再試一次嗎? – JonathanStevens

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.' 
     ) 
    ); ?> 
相關問題