Lately I've been using forms a little differently. What I'm doing now is
allowing my domain entities to construct and return their own forms. For
example:

$user = new Default_Model_User();
$form = $user->getForm();

It looks like this under the hood:

class Default_Model_User
{
    public function getForm()
    {
        $form = new Default_Form_User(array('user' => $this));
    }
}

Since I am passing in the full user object, my form can now make better
decisions on how to present itself, like setting default form values. This
eliminates the need to call populate(), and everything I need is available
within the form's init().

--
Hector


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

>
> Yes Hector had to use by passing data to the constructor. This make my
> controller bigger since i was shared the same form validation  (via service
> layer) to my "add" and "edit" actions.
>
> Well at least works now.
>
> Thanks everyone .
>
>
> --
> View this message in context:
> http://n4.nabble.com/Zend-Form-get-populated-values-tp1752149p1752202.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

Reply via email to