php - 如何删除 Zend Framework 中的表单属性?

标签 php zend-framework zend-form

我有一个表单元素:

$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/

相关文章:

php - Laravel Model函数 “create”和 “insert”有什么区别?

php - 此分发未配置为允许 HTTP 请求

php - Zend 异常行为 : can not process 2nd request when 1st request still running

zend-framework2 - ZF2中CSRF的默认超时

php - Zend Framework 复选框装饰器

php - Mysql查询忽略NULL和空字段

php - 从 WP Job Manager 列表中删除永久链接的公园

php - 重构 Zend_Controller_Action

php - 优化Zend框架路由

php - Zend 表单 : How to pass parameters into the constructor?