implemented form input validation