I'm working on a site that someone else made, it doesn't currently use zend
forms so I'm thinking of replacing some of the raw html forms with zend
forms. I've added a test form:
class App_Form_TestForm extends Zend_Form {
public function __construct() {
$this->setDecorators(array(
'FormElements',
'Form'
));
parent::__construct();
$this->setAttrib('id', 'preview');
$this->setAction('update')->setMethod('post');
$this->addElement('text', 'orgName', array(
'label' => 'Organisation',
'id' => 'orgName'
));
}
}
Create an instance of it and pass it to the view in the controller:
$testForm = new App_Form_TestForm();
$this->view->testForm = $testForm;
and try to output it in the view:
echo $this->testForm;
But I get a fatal error:
Method App_Form_TestForm::__toString() must return a string value
It looks like the Zend_Form_Decorator_Form is trying to call
Zend_View_Helper_Form but is getting a Zend_View_Helper_Form object rather
than the string of html. I've included the beginning of what is returned
below.
Zend_View_Helper_Form(
postBack =
NULL
view =
Zend_View(
_useViewStream =
TRUE
_useStreamWrapper =
FALSE
_path =
array(
['script'] =>
array(
...
Can anyone help? I think I'm probably just doing something stupid and
obvious, I've never had this problem with forms before.
Cheers.
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/Problem-with-Zend-1-12-Form-tp4659435.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]