input validation works much better while using input event to do the manipulation