Moved onkeydown event to dialog.