Mercurial > lada > lada-client
comparison app/view/widgets/LadaForm.js @ 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 | 8525e3525538 |
comparison
equal
deleted
inserted
replaced
74:5c58c0e8936b | 75:4a82e28dfcc4 |
---|---|
15 * Only applicable if model provided is a model class name (string). | 15 * Only applicable if model provided is a model class name (string). |
16 */ | 16 */ |
17 modelId: null, | 17 modelId: null, |
18 bodyPadding: '10 10', | 18 bodyPadding: '10 10', |
19 border: 0, | 19 border: 0, |
20 | |
21 errors: null, | |
22 warnings: null, | |
23 message: null, | |
20 | 24 |
21 initComponent: function() { | 25 initComponent: function() { |
22 | 26 |
23 this.callParent(); | 27 this.callParent(); |
24 | 28 |
64 if (operation.wasSuccessful()) { | 68 if (operation.wasSuccessful()) { |
65 console.log('Save was successfull'); | 69 console.log('Save was successfull'); |
66 this.fireEvent('savesuccess', this, records, operation); | 70 this.fireEvent('savesuccess', this, records, operation); |
67 } else { | 71 } else { |
68 console.log('Save was not successfull'); | 72 console.log('Save was not successfull'); |
69 var errors = operation.request.scope.reader.jsonData["errors"]; | 73 this.errors = this.translateReturnCodes(operation.request.scope.reader.jsonData["errors"]); |
70 this.form.markInvalid(errors); | 74 this.warnings = this.translateReturnCodes(operation.request.scope.reader.jsonData["warnings"]); |
75 this.message = Lada.getApplication().bundle.getMsg(operation.request.scope.reader.jsonData["message"]); | |
76 this.form.markInvalid(this.errors); | |
71 this.fireEvent('savefailure', this, records, operation); | 77 this.fireEvent('savefailure', this, records, operation); |
72 } | 78 } |
73 if (callback) { | 79 if (callback) { |
74 callback.call(scope || this, this, operation.wasSuccessful(), this.model); | 80 callback.call(scope || this, this, operation.wasSuccessful(), this.model); |
75 } | 81 } |