fixed JS to show validation errors as server is now sending status code 400

This commit is contained in:
cnenning
2017-02-21 09:47:59 +01:00
parent 9fcf2dfca7
commit c8630ac56d
@@ -112,8 +112,13 @@ function ajaxFormValidation(event) {
if (restoreFunction) {
restoreFunction();
}
// show user an error message
_handleValidationResult(_form, {errors: ['Network or server error!']})
// struts sends status code 400 when validation errors are present
if (xhr.status === 400) {
_handleValidationResult(_form, JSON.parse(xhr.responseText))
} else {
// a real error occurred -> show user an error message
_handleValidationResult(_form, {errors: ['Network or server error!']})
}
}
}