function validateMessage(operator){

       //Read content of message input field
       var message= $('#message').val();
       //console.log('message inhalt in validate Funktion', message);
       //console.log('Operator', operator);
     
       //if not old arrow button has been clicked respectively the new create button has been submitted 
       //then not only the message input field, but also the channel input field needs to be validated
       if (operator != 'old') {
          var channelName= $('#channelName').val();
          var firstLetter= channelName.charAt(0);
          var positionBlank= channelName.indexOf(' ');
          //console.log('channelName(1): ', channelName.charAt(0));
          //console.log('channelName(1): ', channelName.slice(0,1));
          //console.log('channelName(1): ', channelName.substr(0,1));
          //console.log('First Letter: ', firstLetter);
          //console.log('Position Blank: ', positionBlank);
       // If a message as well as a channel name have been entered in input fields and channel name starts with # sign, then message and channel are valid
       if (message.length >0 && channelName.length >0 && firstLetter == "#"  && positionBlank <0 ) {
          return true;
       }
       else{
          return false;
       }
    }

    //if old arrow button respectively not new create button has been submitted then only the meessage needs to be valdated, not the channel name
    //Message needs to be not empty
    else if (operator == 'old') {
        //console.log('In old Prüfung');
        if (message.length >0) {
            return true;
        }
        else{
            return false;
        }
    } else {

    }
}
// New: Message and Channel name will be validated if their input is correct
Message and Channel name will be validated if their input is correct
Message and Channel name will be validated if their input is correct
function validateMessage(operator){
       var message= $('#message').val();
       if (operator != 'old') {
          var channelName= $('#channelName').val();
          var firstLetter= channelName.charAt(0);
          var positionBlank= channelName.indexOf(' ');
       if (message.length >0 && channelName.length >0 && firstLetter == "#"  && positionBlank <0 ) {
          return true;
       }
       else{
          return false;
       }
    }
    else if (operator == 'old') {
        if (message.length >0) {
            return true;
        }
        else{
            return false;
        }
    } else {
    }
}
function validateMessage ( operator ) { var message = $ ( '#message' ) . val ( ) ; if ( operator != 'old' ) { var channelName = $ ( '#channelName' ) . val ( ) ; var firstLetter = channelName . charAt ( 0 ) ; var positionBlank = channelName . indexOf ( ' ' ) ; if ( message . length > 0 && channelName . length > 0 && firstLetter == "#" && positionBlank < 0 ) { return true ; } else { return false ; } } else if ( operator == 'old' ) { if ( message . length > 0 ) { return true ; } else { return false ; } } else { } }
New: Message and Channel name will be validated if their input is correct
New : Message and Channel name will be validated if their input is correct
//Read content of message input field //console.log('message inhalt in validate Funktion', message); //console.log('Operator', operator); //if not old arrow button has been clicked respectively the new create button has been submitted  //then not only the message input field, but also the channel input field needs to be validated //console.log('channelName(1): ', channelName.charAt(0)); //console.log('channelName(1): ', channelName.slice(0,1)); //console.log('channelName(1): ', channelName.substr(0,1)); //console.log('First Letter: ', firstLetter); //console.log('Position Blank: ', positionBlank); // If a message as well as a channel name have been entered in input fields and channel name starts with # sign, then message and channel are valid //if old arrow button respectively not new create button has been submitted then only the meessage needs to be valdated, not the channel name //Message needs to be not empty //console.log('In old Prüfung');