You can pass in an associative array to Zend_Form's constructor, which will
proxy to matching setter methods. Since it happens during construction, you
will be able to access them during Zend_Form#init(). For example:

class MyForm extends Zend_Form
{
    protected $_foo;

    public function setFoo($foo)
    {
        $this->_foo = $foo;
    }

    public function init()
    {
        var_dump($this->_foo);
    }
}

$form = new MyForm(array('foo' => 123)); // dumps 123

Another option would be to add new methods to manipulate the form after
populating it.

--
Hector


On Mon, Apr 5, 2010 at 3:24 PM, eduardocury <[email protected]> wrote:

>
> I need to change an element behaviour based in my data , for example to add
> an readOnly attribute based in my data, If data is "1" i let the field
> readoly, if not, do nothing.
>
>
> I have tried passing atributes to the constructor but is not so nice since
> i
> already opened my zend_form instance in my init controller. And in this
> case
> i am doing my stuff in my edit action where i just would likte to populate
> the form with my data retrieved from db.
>
>
> Thanks
> --
> View this message in context:
> http://n4.nabble.com/Zend-Form-get-populated-values-tp1752149p1752174.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

Reply via email to