You can use something like this function captureEnter () { var keycode; if (window.event) keycode = window.event.keyCode; if (keycode == 13) { //Your processing } }
You can call this function on keyPress event of your control ----- Original Message ----- From: "Daniel Joshua" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Monday, December 30, 2002 2:27 PM Subject: RE: disable enter key > Another question: > > If I have no submit button. How do I make it that the 'Enter' key triggers a > JavaScript function? > > This is because I need to do some processing before submitting. > > Regards, > Daniel > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Saturday, December 28, 2002 2:07 AM > To: [EMAIL PROTECTED] > Subject: RE: disable enter key > > > But the default behavior of Enter in a browser (IE?) is to invoke the form > submission. For example, if you hit Enter on a login page, it acts like you > click the Sing-In button. There is no JS involved. > > Regards, > > > Phillip Qin > > "This Guy Thinks He Knows Everything" > Canadian Shareowner > 121 Richmond Street W, 7th Floor > Toronto, ON M5H 2K1 > (416) 595-9600 ext 291 > > > -----Original Message----- > From: James Childers [mailto:[EMAIL PROTECTED]] > Sent: December 27, 2002 1:03 PM > To: Struts Users Mailing List > Subject: RE: disable enter key > > No. > > Struts is a server-side platform. It can make client-side tasks easier, such > as validation, but this falls outside it's realm of responsibility. You'll > have to use JavaScript. > > -= J > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > Sent: Friday, December 27, 2002 11:59 AM > > To: [EMAIL PROTECTED] > > Subject: disable enter key > > > > > > Dumb question. Is it able to disable "Enter" key without > > using JavaScript on > > any struts-powered page? > > > > Regards, > > > > > > > > Phillip Qin > > > > "This Guy Thinks He Knows Everything" > > > > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>