validation while accepting user input