for filtering keystrokes and paste events in an html input field