473,700 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Difference between hitting enter and clicking submit?

23s
My site's login page has a form w/ 2 textboxes and a submit button. If I'm
in either of those textboxes (i.e., either one of the textboxes has focus),
in any given browser, hitting "enter" on my keyboard submits the form.
Server side, I handle the click event of the submit button. This is the
expected behavior, and this is the behavior irrespective of what browser I
use on the login page. However...

I have different page that is an email submittal form. It has just 1
textbox and a submit button. On this page, and only when using IE 6.0,
there is a server-side difference between hitting "enter" as opposed to
physically clicking the submit button on the client. The difference being
that if "enter" is used to submit the form, the page performs a postback
(ispostback = true), but the click event of the button never fires. On the
other hand, if the button is physically clicked on the client, again
ispostback=true but now the click event _does_ fire. This is not the
behavior I was expecting - I expected identical behavior as to my login
form, where the method of submittal on the client is transparent to the
server, which should simply believe that submit button was "clicked".

With other browsers (NN 7.2, FF 1.0, Opera) you can hit "enter" or
physically click and there is no difference server side (the click event
fires either way).

I have gone over the code with a fine toothed comb and cannot find any
relevant difference between my login form and my email form that would cause
this behavior (in fact I was not even aware this behavior was possible). Is
this a known issue of any kind? What exactly should I be looking for here?
Nov 19 '05 #1
2 3111
I agree that the default behavior is less than intuitive. You can take
control of the situation, however, using client side script.

Here's a couple good articles on the subject:
http://www.allasp.net/enterkey.aspx
http://www.aspnetpro.com/features/20...200406so_f.asp

Or you could just use this free control.
http://www.metabuilders.com/tools/DefaultButtons.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"23s" <as**@asdf.co m> wrote in message
news:ou******** ************@sp eakeasy.net...
My site's login page has a form w/ 2 textboxes and a submit button. If
I'm in either of those textboxes (i.e., either one of the textboxes has
focus), in any given browser, hitting "enter" on my keyboard submits the
form. Server side, I handle the click event of the submit button. This is
the expected behavior, and this is the behavior irrespective of what
browser I use on the login page. However...

I have different page that is an email submittal form. It has just 1
textbox and a submit button. On this page, and only when using IE 6.0,
there is a server-side difference between hitting "enter" as opposed to
physically clicking the submit button on the client. The difference being
that if "enter" is used to submit the form, the page performs a postback
(ispostback = true), but the click event of the button never fires. On
the other hand, if the button is physically clicked on the client, again
ispostback=true but now the click event _does_ fire. This is not the
behavior I was expecting - I expected identical behavior as to my login
form, where the method of submittal on the client is transparent to the
server, which should simply believe that submit button was "clicked".

With other browsers (NN 7.2, FF 1.0, Opera) you can hit "enter" or
physically click and there is no difference server side (the click event
fires either way).

I have gone over the code with a fine toothed comb and cannot find any
relevant difference between my login form and my email form that would
cause this behavior (in fact I was not even aware this behavior was
possible). Is this a known issue of any kind? What exactly should I be
looking for here?

Nov 19 '05 #2
23s
Thank you, this is certainly it.

"Steve C. Orr [MVP, MCSD]" <St***@Orr.ne t> wrote in message
news:uB******** ******@TK2MSFTN GP15.phx.gbl...
I agree that the default behavior is less than intuitive. You can take
control of the situation, however, using client side script.

Here's a couple good articles on the subject:
http://www.allasp.net/enterkey.aspx
http://www.aspnetpro.com/features/20...200406so_f.asp

Or you could just use this free control.
http://www.metabuilders.com/tools/DefaultButtons.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"23s" <as**@asdf.co m> wrote in message
news:ou******** ************@sp eakeasy.net...
My site's login page has a form w/ 2 textboxes and a submit button. If
I'm in either of those textboxes (i.e., either one of the textboxes has
focus), in any given browser, hitting "enter" on my keyboard submits the
form. Server side, I handle the click event of the submit button. This
is the expected behavior, and this is the behavior irrespective of what
browser I use on the login page. However...

I have different page that is an email submittal form. It has just 1
textbox and a submit button. On this page, and only when using IE 6.0,
there is a server-side difference between hitting "enter" as opposed to
physically clicking the submit button on the client. The difference
being that if "enter" is used to submit the form, the page performs a
postback (ispostback = true), but the click event of the button never
fires. On the other hand, if the button is physically clicked on the
client, again ispostback=true but now the click event _does_ fire. This
is not the behavior I was expecting - I expected identical behavior as to
my login form, where the method of submittal on the client is transparent
to the server, which should simply believe that submit button was
"clicked".

With other browsers (NN 7.2, FF 1.0, Opera) you can hit "enter" or
physically click and there is no difference server side (the click event
fires either way).

I have gone over the code with a fine toothed comb and cannot find any
relevant difference between my login form and my email form that would
cause this behavior (in fact I was not even aware this behavior was
possible). Is this a known issue of any kind? What exactly should I be
looking for here?


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
10063
by: |-|erc | last post by:
these 3 lines will put the following into the URL bar! but with 2 input boxes it doesn't. <form name=test> <INPUT name='selqty2'> </form> file:///C:/WINDOWS/DESKTOP/tttt2.html?selqty2=55555
1
3805
by: ritelman | last post by:
Hi I have one text field and one submit button. If I hit the submit button with a mouse the key/value pair key are properly submitted. However, if I just hit the enter key the page does get submitted however without the key/value pair of the submit button. I would accept that a user must click the button to submit the pair, but none of my other pages require that. It seems if I just hit the enter key it defaults to hitting the submit...
3
11675
by: Megha Vishwanath | last post by:
Hi, I have a struts form <html:form> in which although the focus rests on the submit button, hitting the enter key does not submit the form. I tried capturing the Enter key event and followed it by the document.form.submit() but this takes me through the validation attached with the submit twice( giving me all the alerts twice). Here's the code
5
2778
by: Dennis Allen | last post by:
Hi. I have a user who wants his form submitted when he presses . Is it possible? If so, how?
10
3034
by: Perry van Kuppeveld | last post by:
Hi, I have a problem with formatting a table including text fields wich can contain up to 255 chars. I need a table with 3 columns: - First column 50 % over the with a rowspan of the total number of rows. - Second column 25 %, no rowspan - Third column 25 %, no rowspan
1
2326
by: Alexboy | last post by:
Hello, How do I make ENTER key act as a submit request? As it is now, the user has to actually click "submit" for the form to be submitted (in IE at least). Is there any way to make the enter key submit the form? Example:
4
2751
by: sowencheung | last post by:
Hi, all The scenario is like this: I have a master page, contains two user controls, one is a search control, another is a login control. The server-side <form> is in the master page, that's of course. It seems the search control is rendered first, when I stay in the
6
4930
by: Paul Furman | last post by:
I'm getting incorrect response when hitting the enter key instead of actually clicking the button on a form. It activates but the post data isn't being sent I think. The php generated page flickers & reloads but doesn't perform the update. This is php generated, I'm just pasting the page source (reformatted & extra junk removed and I think they are now identical), and it's running on my localhost apache server for testing so maybe...
2
1675
by: Sunfire | last post by:
I was wondering if there was a way to hit enter to insert blank lines while in the designer? I tried this but all it seems to want to do is insert code that really shouldn't be there. For example, I had a heading 1 centered on a page. Right under that I had some words in smaller print right under the heading. When I hit enter after the heading 1, it automatically put the text right below it in a <p></ptag. I don't want this sort of stuff to...
0
8728
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8647
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9217
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8926
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5903
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4659
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2392
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.