[thelist] Can't submit form data with 'enter' key in IE

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Tue Mar 7 14:16:23 CST 2006


It should be doing that by default, or so I thought... if not, you can add the following to your body element (or any sub-element therein):

onkeydown="if(window.event.keyCode==13){document.forms[0].submit();}"

Of course you'd probably want to encapsulate this to avoid errors in Mozilla, which uses event.which instead of event.keyCode.

HTH,

Peter

 From: "Jim Davis" jim4realty at gmail.com

I have a form with a text field for input and a submit button used to search
a database. In Fire Fox, entering text in the text field and hitting the
keyboard 'enter' key will return the search result. In IE, however, entering
the same text and hitting the keyboard 'enter' key returns no result. IE
requires the 'submit' button to be clicked to perform the search. What do I
need to do to get IE to respond correctly to the 'enter' key?

Jim Davis



More information about the thelist mailing list