Textfield validation

Hello good people! :beer:

I was just wondering. Please, have a look on the following code:


if(myText.text == ""){
    trace("Please, fill in some text");
}
else{
    trace("Thanks a lot dude!");
}  

A simple text validation, right? The problem is that, if the user hits the spacebar, it still validates. Is there any way to solve this?

Thanks!