我有一个表单元素:
$Form=new Zend_Form;
$Form->setAction($this->view->url(array('controller'=>'auth','action'=>'create'),null,true))
->setMethod('post')
->setAttrib('id','auth-form')
->removeAttrib('enctype');
可以看出,我使用 removeAttrib 方法删除了默认的 enctype。但是,当我回应表格时,我仍然得到:
<form id="auth-form" enctype="application/x-www-form-urlencoded" action="/auth/resetpassword2" method="post">
最佳答案
检查一下。 Zend_Form_Decorator_Form
的第 92 行:
if ($method == Zend_Form::METHOD_POST) {
$this->setOption('enctype', 'application/x-www-form-urlencoded');
}
因此,如果是 post,则会自动添加 enctype。您可以覆盖装饰器并删除,但我不确定设置 enctype 是否有任何问题。
关于php - 如何删除 Zend Framework 中的表单属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1422416/