PDA

View Full Version : submit returns false with enter key


perayo
06-23-2003, 06:01 PM
A form with only 1 field:

<form action="formmail.cgi" method="post">
Name <input type="text" name="Name">
<input type="submit" name="submit" vaue="submit">

After filling in the Name field and hit the enter key on my keyboard, it doesnt do anything. Actually, the pg kinda blinks and whatever I filled in is gone. It's like the pg just reloads. I must use my mouse to hit the submit button in order for it to do what it's supposed to do.

This only happens when the form has 1 field. When there's more than 1, it works fine.

Why is that?
Thanks.

Ben@WEBProp
06-23-2003, 06:06 PM
If you had an example published or attached, then maybe I could look at it. But as of now, that's a really good question! Either attach an example or let me know what the answer is when someone else tells ya...

-Ben

NL_Fred
02-24-2004, 01:39 PM
Hello,

If I have a form with only one text field and a submit button. The form doen not submit when enter pressed. If I have two or more fields in a form the form does submit normal when enter is pressed. Does anyone know why and even better, how to solve this.

Regards,

Fred

Axelred66
02-28-2007, 10:25 AM
A lot of browsers have this strange behavior. I've tested this with Internet Explorer 6 and 7, both fail. Firefox 2.0.0.2, Opera 9... all of them fail. But Firefox 2.0.0.0 on a Debian Linux does the trick very well.
Anyway, here's a very simple workaround which works everywhere : just add a extra input-field and hide it. So the example will be :

<form action="formmail.cgi" method="post">
Name <input type="text" name="Name">
<input type="text" style="display:none">
<input type="submit" name="submit" value="submit">

Sorry for this rather late answer :) but I only just discovered this forum today!

Grtz