beginning of displaying form errors, need to keep working on this.

This commit is contained in:
Naomi 2013-08-23 15:52:49 -04:00
parent b2828d466d
commit dbe160c5d9
3 changed files with 19 additions and 2 deletions

View file

@ -164,6 +164,13 @@ class PlayouthistoryController extends Zend_Controller_Action
$historyService = new Application_Service_HistoryService(); $historyService = new Application_Service_HistoryService();
$json = $historyService->createPlayedItem($params); $json = $historyService->createPlayedItem($params);
if (isset($json["form"])) {
$this->view->form = $json["form"];
$json["form"] = $this->view->render('playouthistory/dialog.phtml');
unset($this->view->form);
}
$this->_helper->json->sendJson($json); $this->_helper->json->sendJson($json);
} }
catch (Exception $e) { catch (Exception $e) {
@ -214,6 +221,13 @@ class PlayouthistoryController extends Zend_Controller_Action
$historyService = new Application_Service_HistoryService(); $historyService = new Application_Service_HistoryService();
$json = $historyService->editPlayedItem($params); $json = $historyService->editPlayedItem($params);
if (isset($json["form"])) {
$this->view->form = $json["form"];
$json["form"] = $this->view->render('playouthistory/dialog.phtml');
unset($this->view->form);
}
$this->_helper->json->sendJson($json); $this->_helper->json->sendJson($json);
} }
catch (Exception $e) { catch (Exception $e) {

View file

@ -719,6 +719,7 @@ class Application_Service_HistoryService
$msgs = $form->getMessages(); $msgs = $form->getMessages();
Logging::info($msgs); Logging::info($msgs);
$json["form"] = $form;
$json["error"] = $msgs; $json["error"] = $msgs;
} }
@ -756,6 +757,7 @@ class Application_Service_HistoryService
$msgs = $form->getMessages(); $msgs = $form->getMessages();
Logging::info($msgs); Logging::info($msgs);
$json["form"] = $form;
$json["error"] = $msgs; $json["error"] = $msgs;
} }

View file

@ -460,8 +460,9 @@ var AIRTIME = (function(AIRTIME) {
$.post(url, data, function(json) { $.post(url, data, function(json) {
//TODO put errors on form. //TODO put errors on form.
if (json.error !== undefined) { if (json.form !== undefined) {
var $newForm = $(json.form);
$hisDialogEl.html($newForm.html());
} }
else { else {
removeHistoryDialog(); removeHistoryDialog();