开发者

How do I set the id of the form in Zend_form

开发者 https://www.devze.com 2023-04-12 19:02 出处:网络
I would like to set the id of the form, I can set the id of its elements okay. class Form_Purchase extends Zend_Form

I would like to set the id of the form, I can set the id of its elements okay.

class Form_Purchase extends Zend_Form
{
    protected $_id = 'purchase';

    public function init()
    {
  开发者_开发技巧      ....
    }
}

didn't work!

All I got was...

<form action="" method="post" enctype="application/x-www-form-urlencoded">
<dl class="zend_form">
....


Here is the code (put this line into the init method):

$this->setAttrib('id', $_id);


If in your case you can use the form name as the id, you could use this too, again in your init.

$this->setName($_id);
0

精彩评论

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

关注公众号