How to validate text data