public function processAction() { if (!$this->_request->isXmlHttpRequest() || !$this->_request->isPost()) { $this->_redirect('/admin/forms/'); } $return = array(); $formGateway = new Forms_Model_FormGateway(); $form = $formGateway->getForm('ModifyForm'); if ($form->isValid($this->_request->getPost())) { $form = $formGateway->create($form->getValues()); $form->save(); $flashMessenger = $this->_helper->getHelper('FlashMessenger'); $flashMessenger->setNamespace('notifications')->addMessage('Form updated.'); if ($this->_request->getParam('close') == 1) { $return['redirect']['location'] = '/admin/forms/'; } else { $return['notification']['target'] = '.notifications'; $return['notification']['content'] = $this->view->displayMessages(true); } } else { $return['formErrors'] = $form->getMessages(); } //$return['redirect']['location'] = '/admin/forms'; $this->_helper->json->sendJson($return); }