Fixes an issue where success is still called when AJAX validation fails

This commit is contained in:
Sam Georges 2014-06-02 18:16:39 +10:00
parent 88b138e0d7
commit 1728295f3f
3 changed files with 5 additions and 2 deletions

View File

@ -339,7 +339,7 @@ class Controller extends Extendable
$responseContents = [];
$responseContents['#layout-flash-messages'] = $this->makeLayoutPartial('flash_messages');
$responseContents['X_OCTOBER_ERROR_FIELDS'] = $ex->getFields();
return Response::make()->setContent($responseContents);
return Response::make($responseContents, 406);
}
catch (Exception $ex) {
Log::error($ex);

View File

@ -140,7 +140,7 @@ if (window.jQuery === undefined)
var _event = jQuery.Event('ajaxErrorMessage')
$(window).trigger(_event, [message])
if (_event.isDefaultPrevented()) return
alert(message)
if (message) alert(message)
},
/*

View File

@ -256,6 +256,9 @@ class PluginManager
if (!isset($this->plugins[$identifier]))
$identifier = $this->normalizeIdentifier($identifier);
if (!isset($this->plugins[$identifier]))
return null;
return $this->plugins[$identifier];
}