Skip to content

Commit 542fb6d

Browse files
committed
errorsToForm
1 parent d91c04e commit 542fb6d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

services/static-webserver/client/source/class/osparc/auth/ui/RequestAccount.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,9 @@ qx.Class.define("osparc.auth.ui.RequestAccount", {
418418
this.fireDataEvent("done");
419419
})
420420
.catch(err => {
421+
if ("errors" in err) {
422+
osparc.utils.Utils.errorsToForm(this._form, err.errors);
423+
}
421424
osparc.FlashMessenger.logError(err);
422425
this.__restartCaptcha();
423426
});

services/static-webserver/client/source/class/osparc/utils/Utils.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,21 @@ qx.Class.define("osparc.utils.Utils", {
9191

9292
FLOATING_Z_INDEX: 1000001 + 1,
9393

94+
errorsToForm: function(form, errors) {
95+
const items = form.getItems();
96+
// reset validity
97+
items.forEach(item => item.setValid(true));
98+
errors.forEach(error => {
99+
const msg = error.message;
100+
const field = error.field;
101+
if (field && field in items) {
102+
const item = items[field];
103+
item.setValid(false);
104+
item.setInvalidMessage(msg);
105+
}
106+
});
107+
},
108+
94109
getBounds: function(widget) {
95110
const bounds = widget.getBounds();
96111
const cel = widget.getContentElement();

0 commit comments

Comments
 (0)