add check for focusout or keypress of enter