Validation for text

Used precious code to validate for text from the user input.