Check new conversation messages

This commit is contained in:
Pierre 2017-06-21 18:38:42 +02:00
parent 207ca44ac7
commit 7383be8fe9
2 changed files with 20 additions and 2 deletions

View File

@ -256,3 +256,20 @@ 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;
}

View File

@ -567,7 +567,8 @@ ComunicWeb.components.conversations.chatWindows = {
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;