Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Difference between hitting enter and clicking submit?

Reply
Thread Tools

Difference between hitting enter and clicking submit?

 
 
23s
Guest
Posts: n/a
 
      02-22-2005
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?


 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      02-22-2005
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" <> wrote in message
newsumdnXdYHZHl4obfRVn-...
> 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?
>



 
Reply With Quote
 
 
 
 
23s
Guest
Posts: n/a
 
      02-22-2005
Thank you, this is certainly it.

"Steve C. Orr [MVP, MCSD]" <> wrote in message
news:...
>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" <> wrote in message
> newsumdnXdYHZHl4obfRVn-...
>> 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?
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hitting enter or shift+enter in asp.net designer messes up html code? Sunfire ASP .Net 2 11-06-2007 02:44 PM
hitting enter on a form instead of clicking the button Paul Furman HTML 4 03-17-2007 03:22 AM
capturing from text area Shft+Enter, Control+Enter, Alt+Enter and browser issue. HopfZ Javascript 0 08-28-2006 10:11 AM
Difference between bin and obj directories and difference between project references and dll references jakk ASP .Net 4 03-22-2005 09:23 PM
hitting "enter" on a page MattB ASP .Net 2 05-24-2004 09:54 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57