Discussions

Web tier: servlets, JSP, Web frameworks: Using Struts avoid form submission on enter key press

  1. Using Struts avoid form submission on enter key press (1 messages)

    Using struts how to avoid form submission on enter key press.
  2. 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