used function to validate user input text