public function editAction() { $this->view->title = "Country - Edit"; $this->view->headTitle($this->view->title); $id = $this->_getParam('id'); $model1 = new Application_Model_Country(); $model = $model1->find($id); $options['name'] = $model->getName(); $options['continentId'] = $model->getContinentId(); $request = $this->getRequest(); $form = new Admin_Form_Country(); $form->populate($options); $options = $request->getPost(); if ($request->isPost()) { if ($form->isValid($options)) { $model->setOptions($options); $model->save($model); $this->view->successMsg = "Country Id : {$model->getId()}' has been updated successfully!"; } else { $form->reset(); $form->populate($options); } } $this->view->form = $form; }
public function validateAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->getHelper('layout')->disableLayout(); $form = new Admin_Form_Country(); $form->isValid($this->_getAllParams()); $json = $form->getMessages(); header('Content-type: application/json'); echo Zend_Json::encode($json); }