开发者

Need sfwidgetformtextarea syntax

开发者 https://www.devze.com 2023-03-31 15:50 出处:网络
I want to write the following HTML in symfony forms. <textarea name=\"styled-textarea\" onfocus=\"this.value=\'\'; setbg(\'#e5fff3\');\" onblur=\"setbg(\'white\')\">Enter your comment here...&l

I want to write the following HTML in symfony forms.

<textarea name="styled-textarea" onfocus="this.value=''; setbg('#e5fff3');" onblur="setbg('white')">Enter your comment here...</textarea>

Please开发者_JAVA百科 show me the exact sfwidgetformtextarea syntax for the above HTML textarea. Thanks in advance


You must create new Class extending a symfony class for forms.

class YourForm extends sfBaseForm{

`public function setup(
    'your_field_name' => new sfWidgetFormInputText(array(),array('name'=>"styled-textarea",'onfocus'=>"this.value='';setbg('#e5fff3');",onblur=>"setbg('white')",'value'=>"Enter your comment here......"))
  );`

Then just make instances of your class in the your views, good luck

0

精彩评论

暂无评论...
验证码 换一张
取 消