itaym02 0 Posted September 14, 2009 Share Posted September 14, 2009 I have a Form element: $Form=new Zend_Form; $Form->setAction($this->view->url(array('controller'=>'auth','action'=>'create'),null,true)) ->setMethod('post') ->setAttrib('id','auth-form') ->removeAttrib('enctype'); As can be seen I use the removeAttrib method to remove the default enctype. But, when I echo the form I still get: <form id="auth-form" enctype="application/x-www-form-urlencoded" action="/auth/resetpassword2" method="post"> Link to post Share on other sites
thehippy 0 Posted September 19, 2009 Share Posted September 19, 2009 Line: 51 /**#@+ * Encoding type constants */ const ENCTYPE_URLENCODED = 'application/x-www-form-urlencoded'; const ENCTYPE_MULTIPART = 'multipart/form-data'; /**#@-*/ Line: 786 /** * Set encoding type * * @param string $value * @return Zend_Form */ public function setEnctype($value) { $this->setAttrib('enctype', $value); return $this; } /** * Get encoding type * * @return string */ public function getEnctype() { if (null === ($enctype = $this->getAttrib('enctype'))) { $enctype = self::ENCTYPE_URLENCODED; $this->setAttrib('enctype', $enctype); } return $this->getAttrib('enctype'); } As you can see, you may actually be removing the attribute, but as soon as getEnctype() is accessed to write the element the attribute is being overridden. To remove the 'enctype' attribute just for the sake of removing it doesn't make much sense, it's better to explicitly set it so you and the browser have a better chance of getting data back in an expected format. I would argue that the default behaviour is preferred in this case . Link to post Share on other sites
itaym02 0 Posted September 20, 2009 Author Share Posted September 20, 2009 thanks Link to post Share on other sites
Recommended Posts
Archived
This topic is now archived and is closed to further replies.