ZF-5801: Form bug when form-name and element-name is equal.
Description
<?php
// // If foo == bar (eg. form name and element name are equal) and the form is sent without any content (empty) and the standard code for validation is in place (see below) // ____________________________________________________ // if (!$this->_request->isPost()) { // return; // }
// if (!$form->isValid($this->_request->getPost())){ // $form->populate($this->_request->getPost()); // return; // } // ____________________________________________________ // then "array" will be the value of the textarea when the erroneous form is shown. // The problem goes away if foo != bar.
class BugExampleForm extends Zend_Form {
public function init()
{
$this->setName('foo');
$element = new Zend_Form_Element_Textarea('bar');
$element->setLabel('test')
->setRequired(true)
->setAttrib('rows','1')
->setAttrib('cols','1');
$this->addElements(array($element));
}
}
Comments
Posted by Christian Albrecht (alab) on 2010-03-18T08:20:23.000+0000
Fixed in [ZF-9348]
Posted by Christian Albrecht (alab) on 2010-03-25T13:24:00.000+0000
Reopened because suggested fix is not reviewed and committed yet.
Posted by Christian Albrecht (alab) on 2010-03-31T09:48:23.000+0000
Matthew Weier O'Phinney resolved [ZF-9348] Patch applied to trunk and 1.10 release branch.