Mercurial > lada > lada-client
changeset 75:4a82e28dfcc4
Translate error codes and store them as attributes of the form
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Wed, 05 Jun 2013 18:04:39 +0200 |
parents | 5c58c0e8936b |
children | eb8a7d3cca89 |
files | app/view/widgets/LadaForm.js |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/app/view/widgets/LadaForm.js Wed Jun 05 18:04:07 2013 +0200 +++ b/app/view/widgets/LadaForm.js Wed Jun 05 18:04:39 2013 +0200 @@ -18,6 +18,10 @@ bodyPadding: '10 10', border: 0, + errors: null, + warnings: null, + message: null, + initComponent: function() { this.callParent(); @@ -66,8 +70,10 @@ this.fireEvent('savesuccess', this, records, operation); } else { console.log('Save was not successfull'); - var errors = operation.request.scope.reader.jsonData["errors"]; - this.form.markInvalid(errors); + this.errors = this.translateReturnCodes(operation.request.scope.reader.jsonData["errors"]); + this.warnings = this.translateReturnCodes(operation.request.scope.reader.jsonData["warnings"]); + this.message = Lada.getApplication().bundle.getMsg(operation.request.scope.reader.jsonData["message"]); + this.form.markInvalid(this.errors); this.fireEvent('savefailure', this, records, operation); } if (callback) {