Zend adds an enctype to all forms. What's that good for? and how can I remove it?
<form action=""
method="post"
enctype="application/x-www-form-urlencoded"
id="myform">
</form>
Zend adds an enctype to all forms. What's that good for? and how can I remove it?
<form action=""
method="post"
enctype="application/x-www-form-urlencoded"
id="myform">
</form>
It is not possible without patching Zend_Form class or deriving from it and overriding getEnctype()
http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Form.php
Look at the getEnctype()
method.
enctype="application/x-www-form-urlencoded"
is a formality requirement of the POST method. http://www.w3.org/TR/html401/interact/forms.html
If you want to remove it, you have to override the getOptions method of Zend_Form_Decorator_Form and remove the two lines below :
class Zend_Form_Decorator_Form extends Zend_Form_Decorator_Abstract
{
[..]
public function getOptions()
{
if (null !== ($element = $this->getElement())) {
if ($element instanceof Zend_Form) {
[..]
// To remove
if ($method == Zend_Form::METHOD_POST) {
$this->setOption('enctype', 'application/x-www-form-urlencoded');
}
[..]
It is an atribute used to identify what kind of form are you trying to post to the server. In this case it is saying that you send text information. In case you would like to send files e.g. sth more complex you should use "multipart/form-data" value of enctype. See http://www.w3.org/TR/html401/interact/forms.html#adef-enctype for more information.