keydown function for form-field