To pass data from your controller, to a Zend_Form, you can utilise the config parameters:
$this->view->form = new Contact_Edit_Form(array('contactName' => 'Chris'));
This will pass a very simple array to the form, and from within the form,
$data = $this->getAttrib('contactName');
$data will then contain Chris
3 thought on “How to pass data from Controller to Zend Form”
Thanks dude for this simple and efficient trick!
i need to pass a value to the form from controller,
in that form it should be hidden field,
after some process again the all data need to post in controller is possible?
thanks i solve that issue, but i need again to post the value in controller
$data = $this->getAttrib(‘userID’)
this is my form code
i need to post this value in controller is it possible