Discussions
Web tier: servlets, JSP, Web frameworks: Using Struts avoid form submission on enter key press
-
Using Struts avoid form submission on enter key press (1 messages)
- Posted by: anup sahu
- Posted on: September 08 2006 08:38 EDT
Using struts how to avoid form submission on enter key press.Threaded Messages (1)
- Re: Using Struts avoid form submission on enter key press by Bhagvan K on September 08 2006 17:59 EDT
-
Re: Using Struts avoid form submission on enter key press[ Go to top ]
- Posted by: Bhagvan K
- Posted on: September 08 2006 17:59 EDT
- in response to anup sahu
I guess this is nothing to do with struts, but in any web application framework, javascript event handler on the button - onKey - needs to capture the enter key event and ignore the submission.... if (document.layers) document.captureEvents(Event.KEYPRESS); document.onkeypress = function (evt) { var key = document.all ? event.keyCode : evt.which ? evt.which : evt.keyCode; if (key == 13) alert("wrong key"); }; Bhagvan K http://www.jroller.com/page/bhagvank