0

有这个:

echo $view['form'] -> row($form["codelist"], array(
    //widget
    "widgetArgs" => array(
        "attr" => array(
            'class' => 'input-xlarge tooltipRight', 
            'id' => "gift_codelist"
            ),
            "tooltip"=>"gift.tooltip.codelist",
            "translation_domain" =>"brand"


         ),
   "labelArgs" => array(
        "label_attr" => array(
            'class' => 'control-label', 
        )) ,"rowType"=>2
      )
  );

您如何向该文本框添加初始值?

4

1 回答 1

2

如果要向字段添加实际值,可以使用value属性:

"attr" => array(
        'class' => 'input-xlarge tooltipRight', 
        'id' => "gift_codelist",
        'value' => "Your initial value"
        )

但是如果你使用 HTML5 并且只是想给你的用户一个提示,你最好使用placeholder

"attr" => array(
        'class' => 'input-xlarge tooltipRight', 
        'id' => "gift_codelist",
        'placeholder' => "Your initial value"
        )

http://www.w3.org/html/wg/drafts/html/master/forms.html#the-placeholder-attribute

于 2013-02-01T00:04:25.543 回答