File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Keyboard Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Keyboard "Enter" doesn Watch "Keyboard "Enter" doesn New topic
Author

Keyboard "Enter" doesn't work.

Veni Velkoor
Ranch Hand

Joined: Oct 17, 2001
Posts: 65
Hey everyone!

This may seems fairly rudimentary, but has me stumped right now. We have a bunch of JSP pages, which render HTML to the browser ofcourse. Intially, when the user pressed the "ENTER" key on the keyboard, the form was always submitted. But then we made some changes to the JSPs and I think we broket it at that point. Now the keyboard "Enter" does not work, and the user has to use to mouse to click on the "Enter" button on the page, which is annoying to some users.

Thereason for the changes are as follows... Basically,some transactions take a little longer to process . We had some impatient users submitting the form multiple times to get a response and hence double-posting transactions. TO avoid that, we put in som Javascript which disabled all the buttons on the page until they got a response back. I think thats where we broke something. THe code is as follows....


Any advise on how to enable our Keyboard Enter Key will be greatly appreciated.

Thanks much!
Veni

PS --> I did search this forum for solutions with out much luck.
Veni Velkoor
Ranch Hand

Joined: Oct 17, 2001
Posts: 65
Sorry, I forgot to post my my changes that I made to the page as mentioned in my original post.

Here they are-

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Test Page</title>

<LINK rel=stylesheet href="../admin.css">
<META HTTP-EQUIV="Pragma" CONTENT="No-Cache">

<SCRIPT LANGUAGE="JavaScript">
function functionkey(k){
if (k == "&")
{
document.Form1.c__Aid_I.value="'";
} else {
document.Form1.c__Aid_I.value=k;
}
document.Form1.Enter.disabled=true;
document.Form1.PF2.disabled=true;
document.Form1.PF3.disabled=true;
document.Form1.PF4.disabled=true;
document.Form1.PF5.disabled=true;
document.Form1.PF6.disabled=true;
document.Form1.PF7.disabled=true;
document.Form1.PF8.disabled=true;
document.Form1.PF9.disabled=true;
document.Form1.PF10.disabled=true;
document.Form1.PF11.disabled=true;
document.Form1.PF12.disabled=true;
document.Form1.submit();
}
</SCRIPT>

</head>
<body bgcolor= "#faebd7">

<basefont size="1" face="Times Roman" />
<jsp:useBean id="PR004C" class="com.xxx.clcs.test.PR004C" scope="request"></jsp:useBean>
<FORM METHOD="post" NAME=Form1 ACTION="/servlet/PR004S">
.
.
.
.
.
.

<TD> <INPUT TYPE="button" TITLE="Exit" NAME="PF3" ID="PF3" VALUE="F3" onSlick="functionkey('3');" > </TD>
.
.


Thanks!
V
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60732
    
  65

Is there a submit button in the form? Not just any button, but one that has submit semantics. For example an <input> or <button> with type of "submit".

If not, the enter key generally does not cause the form to submit itself.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Veni Velkoor
Ranch Hand

Joined: Oct 17, 2001
Posts: 65
Duh!! :-)

Thanks Bear!!

Sometimes a second set of eyes help a lot.... it is funny how one misses the very obvious while they are staring right at it.

Thanks a bunch again. Have a great weekend!
V
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Keyboard "Enter" doesn't work.
 
Similar Threads
Duplicate form submission - Synchronizer Token Pattern
oracle stored proc for tree
2 buttons listening for the same key
FocusListener
Default Enter key and submit BUTTON