Hi all,

I have a controller which sets up (amends) a form, which is a subclass of
Zend_Form: mainly the controller sets some values and it removes or adds
some elements, depending on whether or not the user is logged in. This is
the code that sets up the form:

                $form = new VK_Forms_User_Comment();
                if (!is_null($this->loggedInUser)) {
                        
$form->getElement('user_id')->setValue($this->loggedInUser['userId']);
                        $form->removeElement('naam');
                        $form->removeElement('website');
                        $form->removeElement('antispam');
                } else {
                        $form->getElement('user_id')->setValue('');
                }
                
$form->getElement('bijdrage_id')->setValue($this->bericht['bijdrage_id']);
                $form->getElement('ip')->setValue($_SERVER['REMOTE_ADDR']);

Now this form posts to another controller. I'm having some trouble deciding
on the best architecture: how do I access this amended form from the
controller that is being posted to? Obviously, I cannot access
VK_Forms_User_Comment directly, because of the changes that were made. So
far, I've solved it by making the form a public static variable of the
initial controller that instantiates and amends the form, and I pick it up
again in the controller that is being posted to; but is that really the best
way to go?

Thanks for any input!
-- 
View this message in context: 
http://www.nabble.com/Best-architecture-for-Zend_Form-tp21539087p21539087.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to