From fa094a1d9f10f9e1a69dc091fb87c990bb4f6056 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 3 Jun 2018 16:48:37 +0200 Subject: [PATCH] Add automatic invalid form info message --- Message/Notification/NotificationLevel.enum.js | 2 ++ UI/Component/Form.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/Message/Notification/NotificationLevel.enum.js b/Message/Notification/NotificationLevel.enum.js index 0b93918..2a23568 100644 --- a/Message/Notification/NotificationLevel.enum.js +++ b/Message/Notification/NotificationLevel.enum.js @@ -14,6 +14,8 @@ jsOMS.Message.Notification.NotificationLevel = Object.freeze({ OK: 'ok', + INFO: 'info', + WARNING: 'warning', ERROR: 'error' }); }(window.jsOMS = window.jsOMS || {})); diff --git a/UI/Component/Form.js b/UI/Component/Form.js index cf5f097..a112045 100644 --- a/UI/Component/Form.js +++ b/UI/Component/Form.js @@ -191,6 +191,10 @@ submitForm (form) { if (!form.isValid()) { + this.app.notifyManager.send( + new jsOMS.Message.Notification.NotificationMessage(jsOMS.Message.Notification.NotificationLevel.INFO, 'Info', 'Invalid form input. Please check the form.'), jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION + ); + jsOMS.Log.Logger.instance.debug('Form "' + form.getId() + '" has invalid values.'); return; }