I would recommend not storing the form data in the session, you might find people will be using the same form (or multiple forms) in multiple windows, this results in overlapping data.
Check out this tutorial: http://akrabat.com/zend-framework-tutorial/ It has a really good example application for forms. Cheers, Steven -----Original Message----- From: Ivan Ruiz Gallego [mailto:[EMAIL PROTECTED] Sent: Wednesday, 5 September 2007 5:03 PM To: rdpweb; [email protected] Subject: Re: [fw-general] how to retain value in form using zend Hi Rohit83, I usually use Zend_Session to keep form data between requests. I serialize the post array an keep it in an own session namespace. Additionally, I pass the form data array to the view in the controller action, so that the view does not need to know about the existence of sessions. Take a look at the sample code below. If everyone has a better idea, I would be happy to know! Best regards, Ivan. /* Display form */ public function displayformAction() { $this->initView(); // Check session for form data $formSession = new Zend_Session_Namespace('form'); if (isset($formSession->formData)) { $formData = unserialize($formSession->formData); $this->view->formData = $formData; } /* Render form */ } /* Check user input */ public function checkformAction() { // Get POST data $request = $this->getRequest(); $post = $request->getPost(); /* Validation logic */ /* If errors, go back to view */ // Pass error message... $this->view->formData = $post; // Redirect /* If input ok */ $formSession = new Zend_Session_Namespace('form'); $formSession->formData = serialize($post); // Go to previewAction, e.g. } > Hi All > I have developed a form using zend framework.When i click on submit > button and id if due to validation some error message is displayed , at that > time the values entered in text box will not be retained. > Is their any way to retain these values using zend functionality > Regard, > Rohit83 > -- Loglan GmbH Ivan Ruiz Gallego Binzmühlestrasse 210 8050 Zürich Switzerland Office +41 44 310 19 20 Mobile +41 76 321 23 68 Net www.loglan.net
