0

有没有办法在表单类中添加自定义表单字段元素?

IE

我想在 UsersForm 类中的 email 元素之后添加一个 span 元素。这是代码

class UsersForm extends BaseUsersForm
{

   public function configure()
   {
      unset($this['created'], $this['updated']);

      $this->widgetSchema['name'] = new sfWidgetFormInput();
      $this->widgetSchema['email'] = new sfWidgetFormInput();

      <!-- code for the span element here -->

      $this->widgetSchema['password'] = new sfWidgetFormInputPassword();
      $this->widgetSchema['retypepassword'] = new sfWidgetFormInputPassword(array(
        'label' => 'Retype Password'
      ));
   }
 }

在电子邮件“表单字段”下方添加 span 元素的代码/方法应该是什么?

谢谢

4

1 回答 1

0

这是一种丑陋的方式,尽量避免这种黑客攻击:

$this->widgetSchema['password'] = new sfWidgetFormInputPassword(array('label'=>'<span></span>password'));
于 2011-06-29T16:23:15.997 回答