changed validation to on keydown