9Jan/096
TECH: Hitting enter?
Okay, so how many of you hit Enter to move between fields in a form online? I didn't realize that hitting enter will submit a form because I've never done that. I either click in the boxes, or use tab.
Anyway, I built a form and the requestor wanted to disable enter on the whole thing. Why? I don't know, but I wanted her to stop bugging me
I found a way to do it, but it's kind of a pain. The first part is the javascript function, make sure it's between the head tags.
<script language="JavaScript">
function disableEnterKey(e)
{
var key;
if(window.event)
key = window.event.keyCode; //IE
else
key = e.which; //firefox
if(key == 13)
return false;
else
return true;
}
</script>
The last part is something you have to put in every single text box (and I had about 100 - thank goodness for find and replace)
<input type=”text” name=”mytext” onKeyPress=”return disableEnterKey(event)”>
The important part is the part in red. Just slap that in each input tag, and you're ready to go.
Anyone have an easier way of doing it?
January 9th, 2009 - 11:23
I usually use “tab” to move from cell to cell in a form?
movindowntheroads last blog post..Everything’s been out
January 9th, 2009 - 14:44
Sorry, I don’t speak techie. I’m usually the person on the bugging side of the situation. My attitude is that if I can imagine it, IT can probably make it reality for me. I’m sure they cringe every time they see a request with my name on it, but this habit has worked out productively for me.
terris last blog post..Life is Good – January 9, 2009
January 9th, 2009 - 14:57
You lost me at : TECH. But I think the most elegant solution to the problem is just to not press enter. Press tab. Does this person have a broken tab key? Or Tabaphobia perhaps?
January 9th, 2009 - 15:00
I dunno, but it just never made sense to me to hit enter when I’m using the internet at all
M@s last blog post..I had a good day today
January 9th, 2009 - 19:09
GUI standards for forms are generally tab between fields, enter to submit, so yeah, lots of internet based forms do that. I’ve seen it many times. But I thought that only happened if it was written into the form to do that, i.e. by attaching the enter key’s click action to the “submit” button, or whatever.
But, yeah, you should expect lots of users to expect it to operate that way. Remember the problem we used to have with the AE website because I thought the login was broken, and it was because hitting enter DIDN’T submit the form? Yeah, it happens.
January 12th, 2009 - 14:06
LOL – oh no. Not me. You’re talking tech speak, and I can barely handle some HTML codes.
The first time I hit enter and it submitted the form was enough for me – I usually stick with tab now. At least I learn my lessons (most of ‘em) the first time, huh?