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

By admin

3 thought on “How to pass data from Controller to Zend Form”
  1. 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?

  2. 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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.