lib: Fix JSON response exception on form failure

This commit is contained in:
Eric Lippmann 2015-10-26 12:30:50 +01:00
parent e07e16d7a1
commit 4593c78d16
1 changed files with 3 additions and 4 deletions

View File

@ -1171,10 +1171,9 @@ class Form extends Zend_Form
$this->getView()->layout()->redirectUrl = $this->getRedirectUrl()->getAbsoluteUrl();
}
} elseif ($this->getIsApiTarget()) {
$this->getResponse()->sendJson(array(
'status' => 'fail',
'data' => array_merge($this->getMessages(), $this->getErrorMessages())
));
$this->getResponse()->json()->setFailData(
array_merge($this->getMessages(), $this->getErrorMessages())
)->sendResponse();
}
} elseif ($this->getValidatePartial()) {
// The form can't be processed but we may want to show validation errors though