diff --git a/assets/js/common/utils.js b/assets/js/common/utils.js index 9e761e06..16e43227 100644 --- a/assets/js/common/utils.js +++ b/assets/js/common/utils.js @@ -255,4 +255,21 @@ function createFormGroup(infos){ //Return input return input; +} + +/** + * Check if a string is valid and ready to be sent to be saved + * + * @param {String} value The input string to send + * @return {Boolean} True if the string is valid, false else + */ +function checkString(value){ + + //First, check string length + if(value.length < 5) + return false; //Lenght invalid + + //Success, the string seems to be valid + return true; + } \ No newline at end of file diff --git a/assets/js/components/conversations/chatWindows.js b/assets/js/components/conversations/chatWindows.js index 89dc9a98..dc9364da 100644 --- a/assets/js/components/conversations/chatWindows.js +++ b/assets/js/components/conversations/chatWindows.js @@ -561,13 +561,14 @@ ComunicWeb.components.conversations.chatWindows = { * @return {Boolean} True for a success */ submitMessageForm: function(convInfos){ - + //Log action ComunicWeb.debug.logMessage("Send a new message in a conversation system."); console.log(convInfos); //Check if message is empty - //if(convInfos.sendMessageForm.inputText) + if(!checkString(convInfos.box.sendMessageForm.inputText.value)) + ComunicWeb.common.notificationSystem.showNotification("Please type a valid message before trying to send it !", "danger", 2); //Success return true;