Text input validation working for first permutation