简体   繁体   中英

How do I set the id of the form in 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">
....

这是代码(将此行放入init方法中):

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

如果您可以使用表单名称作为ID,也可以在init中再次使用它。

$this->setName($_id);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM