add valid input check and clear input box after enter