I'll give this a try. thank you. -----Original Message----- From: Matthew Weier O'Phinney [mailto:[email protected]] Sent: Monday, September 06, 2010 11:15 AM To: [email protected] Subject: Re: [fw-general] processAjax
-- Meroe Kush <[email protected]> wrote (on Sunday, 05 September 2010, 10:26 PM -0400): > Hello, > > > > I'm trying to figure out the best way to redirect after a form is processed and > found valid via processAjax. Here is my controller code: > > > > public function addAction() { > > $form = new App_Forms_Users_Add (); > > if ($this->getRequest ()->isXmlHttpRequest () && $this->getRequest > ()->isPost ()) { > > $response = $form->processAjax ( $this->getRequest ()-> > getPost ()); > > if ($response == 'true') { I'm pretty sure that this is not what you want as a conditional. 'true' is a string, while what you want is the boolean value; as such, just test it: if ($response) { } else { } Also... > $formData = $form->getValues (); > > $last_id = $this->UserModel->add ( $formData ); > > > $this->_redirect('/backend/users/index'); Call return after this statement, or as part of it: return $this->_redirect('/backend/users/index'); That will ensure that if you later configure the redirector not to call exit(), the action will not continue processing. > > } else { > > $this->_helper->json ($response); > > } > > } > > $this->view->form = $form; > > > > } > > > > Everything works just fine except the redirect. Can I not redirect after a > post? Any help would be appreciated. > -- Matthew Weier O'Phinney Project Lead | [email protected] Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
