Feedback: irt.org FAQ Knowledge Base Q1179
Feedback on: irt.org FAQ Knowledge Base Q1179
Sent by David Cooper on September 29, 1999 at 04:02:33: - feedback #487
Worth: Worth reading
Length: Just right
Technical: Just right
Comments: There is a typo in the example code: onKeyPress=keyhander(e) "keyhander" should be written as "keyhandler"
Sent by tom on May 05, 2000 at 21:58:10: - feedback #1190
Worth: Not worth reading
Comments: any form with two text inputs will not be submitted when enter is pressed.... if you remove one of the text fields, the form still submits on enter
Sent by Gary Ackerman on October 17, 2000 at 17:28:15: - feedback #1875
Worth: Very worth reading
Length: Too short
Technical: Not technical enough
Comments: I couldn't get the example to work. First there is an extra quote after keyhander(e) call and then it says that e is undefined. Am I doing something wrong here?
Sent by Brian on October 30, 2000 at 11:58:35: - feedback #1927
Worth: Very worth reading
Comments: The solution provided works for me on one machine and not on another. Both are using the same version of IE. The thing I dont understand is how do you have an 'if' statement outside of the function. Also, you're passing 'e' into keyhandler. How does the program know what 'e' is? I receive an error 'e' is an undefined object. Although on my Computer at work...it works fine. How is this possible. If its undefined....its undefined, it doesnt seem like it should work anywhere. Also I am unfamiliar what the 'e ? e' is. Can you please explain? Thanks Brian
Sent by Rich Yessian on November 26, 2000 at 22:31:45: - feedback #2064
Worth: Worth reading
Comments: However, it doesn't seem to work. For one, the example shown has some obvious errors. keyhandler is misspelled. It is spelled "keyhander" (missing 'l') in the OnKeyPress Second, there is only ONE quote (") at the end...but not at the beginning of the OnKeyPress. After fixing that for my use, it still doesn't work in IE5. I have tried using this, and the only thing that seems to happen is the "Submitted" pop up box comes up....instead of denying the user the ability to press enter to submit the form. Please advise the correct way to solve this problem in IE5. (How to disallow the user from submitting a form by pressing the enter key) Thanks Rich
Sent by dirk on December 11, 2000 at 12:45:55: - feedback #2129
Worth: Not worth reading
Comments: does not stop submission in IE.
Sent by smk on May 02, 2001 at 10:26:55: - feedback #2686
Worth: Very worth reading
Comments: Use: onkeypress="keyhandler(event)"
Sent by Angus Beare on July 10, 2001 at 06:00:26: - feedback #2947
Worth: Very worth reading
Length: Too short
Comments: In theory very worth reading because it is supposed to do want I need to do.. BUT, firstly the script contains an error. It could never work. The function is called KeyHandler but the calls are 'keyhander'.. Secondly there is no explanation of it's component parts which is poor and finally it just doesn't work. Can't work out why but it never catches the ENTER key...
Sent by angus beare on July 10, 2001 at 06:18:29: - feedback #2948
Worth: Worth reading
Comments: I've finally managed to get that wretched script to work. I'm glad 'm not working with the person who posted it. Doesn't say a lot for their work. I'm using IE 4.472/SP1, apart from the obvious syntax error. I got the script to work as such:- onKeyPress="return keyhandler(event)" in your INPUT tags. The guy who said the behaviour goes away when more than one txt control is on the form must be using IE5 or a different build. I've not tested on IE5 yet.
Sent by Lawrence Impey on September 16, 2001 at 11:38:41: - feedback #3166
Comments: The Enter Key is the default keyboard shortcut for a submit button so try the following: <html> <head> <script language=JavaScript> </script> </head> <body> <form method=post name=form_name action=test.pl> <input type=text size=20> <input type=text size=20> <input type=text size=20> <input type=button value=Submit onClick="submitForm();"> </form> </body> </html> Basically, we are replacing the submit button with a standard button and using JavaScript to submit the form when the button is pressed. The enter key will still submit the form, but ONLY if the submit button has the focus (i.e. the user has tabbed onto the button). Unfortunately I think IE 4.0.72 has some problems with using javascript to submit a form.
Sent by Jonno Smith on October 07, 2001 at 23:28:47: - feedback #3225
Worth: Worth reading
Length: Just right
Technical: Not technical enough
Comments: Doesn't work though. Ended up coming up with a solution by myself that works fine, and is, forgive me, rather elegant. Try: <SCRIPT LANGUAGE="JavaScript"> function doButtonMethod() { form1.submit(); } </SCRIPT> <FORM name="form1" method=post action="nextpage.html"> <INPUT TYPE="TEXT" name=text1> <INPUT TYPE="button" onclick="doButtonMethod();" value="Submit"> </FORM>
Sent by J. Scott Fabling on March 11, 2002 at 23:59:36: - feedback #3676
Worth: Not worth reading
Comments: I have been unable to get this to work on my IE 5.xxx. Does anyone have a version that does work? JSf Here is the last code I tried to get working. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> <script language="JavaScript"></script> </head> <body> <form name="myForm" onSubmit="alert('submitted'); return false;"> <input type="text" name="field1" onkeypress="keyhandler(window.event)"> <input type="text" name="field2" onkeypress="keyhandler(window.event)"> <input type="submit" value="eat me"> </form>
</body> </html>
Sent by yo on September 26, 2002 at 10:01:55: - feedback #4174
Technical: Not technical enough
Comments: Much better solution: http://www.cs.tut.fi/~jkorpela/forms/enter.html
Sent by Maarten Hogendoorn on Thursday April 12, 2007 at 10:53:10 - feedback #4433
Worth: Very worth reading
Length:
Technical:
Comments: Works, but in IE6 the function "submitForm();" must be "submit();".
Sent by on Tuesday June 05, 2007 at 19:44:00 - feedback #4673
Worth: Very worth reading
Length:
Technical:
Comments: this item was also useful while I was trying to incorporate a javascript confirm box and the form would keep on submitting even when the user would press "cancel" on the confirm box. What I did was
my submit button
input type = button, onClick= return checksubmit(form);
function checksubmit(form){ var resp = confir("do you say yes or no") if( resp == true){ form.submit() } else { do whatever u like... } }
|