Default Button / Press Enter Key in Web Form

Just notified by a new teammate today: There is page maintaining the master record of employees in one of my ASP.NET internal web app, he entered some text in that page and then press [ENTER], nothing happened so he came to me and told me that the search function is not work.

I go to that page and find that the reason of the "failure" is just because the programmer who wrote this page didn't handle the "Enter" key event, so nothing happen by the keyboard but only response from the "click" action. Ahh... What the...


Anyway, I went to Mike's blog immediately as I remembered he blogged about this topic in the past, I added his code by following his code snippet but it didn't work. (FYI: I have only 1 TextBox and 1 Button on that page only)

Finally, I added few lines of JavaScript code in order to catch this action (the keypoint is this line of code: event.returnValue=false;) and then it worked perfectly! Minor issue but "resume" the functionality. :o)

Colt Kwong

Published Saturday, April 09, 2005 12:53 AM by Colt
Filed under:

Comments

# re: Default Button / Press Enter Key in Web Form

Friday, April 08, 2005 12:03 PM by Scott Galloway

# re: Default Button / Press Enter Key in Web Form

yeah, I think I saw Mike's solution at some point, but I was already using Andy's Smiths Default Buttons control.

http://www.metabuilders.com/Tools/DefaultButtons.aspx


To me, the default buttons control is a much better solution because it allows you to define a button for a specific control on the page declaritively.

Friday, April 08, 2005 12:48 PM by Scott

# re: Default Button / Press Enter Key in Web Form

I have a solution [1] that I posted a while back. This solution involves simply adding an invisible HTML textbox to the page.

This works with all validators and so on...

[1] http://www.mattberther.com/2003/06/000125.html

Friday, April 08, 2005 12:48 PM by Matt Berther

# re: Default Button / Press Enter Key in Web Form

The DefaultButtons control found at www.metabuilders.com works quite well and is free.

Friday, April 08, 2005 6:18 PM by Richard P

# re: Default Button / Press Enter Key in Web Form

Yo! Thanks guys! Appreciate the solutions by all of you! :o)

Friday, April 08, 2005 9:34 PM by Colt

# re: Default Button / Press Enter Key in Web Form

Hi, Colt -- the link above is to the trackback page ... I think you want this one:

http://www.mikepope.com/blog/displayblog.aspx?permalink=309

Thanks,

-- Mike

PS I've updated the entry to point back to this. :-)

Monday, April 11, 2005 12:35 PM by mike

# re: Default Button / Press Enter Key in Web Form

HI,

i have one test box and three buttons(apply,refresh,close).Through java script I am validateing that text box like it should not take desimal value,shuld not take alfebets.

Now if i m clecking on mouse to apply button then it is working fine.

but if I am giveing Enter button then it is not going to my function, where I am validating it.

so can you please sugest me some thing.

Thursday, February 28, 2008 9:09 AM by Debasis Mohapatra

# re: Default Button / Press Enter Key in Web Form

pls help me. not working for me. i have used validation control for this. does it make any difference?

Wednesday, June 18, 2008 6:40 AM by PK

# re: Default Button / Press Enter Key in Web Form

Default Button / Press Enter Key in Web Form

Saturday, January 24, 2009 3:10 AM by Dimple

# re: Default Button / Press Enter Key in Web Form

Hi,

I want the software which press auto Ctrl + G then press enter. I can stop it when ever i required. So please help me with the same.

Thanks,

Pankaj

Monday, April 06, 2009 10:58 AM by Pankaj

# re: Default Button / Press Enter Key in Web Form

Even in this digital age where every bit of information is available in digital form. ,

Thursday, October 22, 2009 7:13 PM by Daddy47

# re: Default Button / Press Enter Key in Web Form

Hi guys. Nobody is ever met at the airport when beginning a new adventure. It's just not done. Help me! Please help find sites for: Mephisto sandals discount. I found only this - <a href="www.lgl.lu/.../mephisto-ladina">mephisto ladina</a>. Mephisto, the paradise x waterproof was never very orphaned, popular to regular system controversy through its tourist. Running to his show meine welt, he had costumed it browsing when arthur friedheim was ordering liszt's lucrezia-fantasy, mephisto. Thanks :mad:. Delilah from Verde.

Monday, March 22, 2010 10:48 PM by Delilah

# re: Default Button / Press Enter Key in Web Form

Really cool blog as for me. It would be nice to read more about this theme. Thanx for sharing this data.

Abigail COLEMAN

<a href=" www.renttobuyguide.co.uk/">rent to buy guide</a>

Tuesday, April 27, 2010 12:05 PM by Abigail COLEMAN

# re: Default Button / Press Enter Key in Web Form

Pretty cool blog you've got here. Thanks for it. I like such themes and everything connected to them. I would like to read more soon.

Julia Benedict

Saturday, August 07, 2010 1:33 AM by brunette London escorts

# re: Default Button / Press Enter Key in Web Form

hsxgoydqxmpvlovfswnsy. <a href=www.acnetreatment2k.com/>acne treatment</a>

gszitv

Sunday, September 05, 2010 11:02 PM by thrhtrurth

# re: Default Button / Press Enter Key in Web Form

It was extremely interesting for me to read the article. Thanks for it. I like such topics and everything connected to this matter. I would like to read more on that blog soon.

Joan Swenson    

<a href="milanescorts.com/">annuncio milano escort</a>

Friday, March 18, 2011 2:36 AM by Joan Swenson

# re: Default Button / Press Enter Key in Web Form

Rather nice place you've got here. Thanx for it. I like such themes and everything that is connected to them. I would like to read a bit more on that blog soon.  

Avril Benedict    

<a href="www.pickescort.com/">private escort</a>

Saturday, April 09, 2011 4:47 PM by Avril Benedict

# re: Default Button / Press Enter Key in Web Form

Wonderful article  at least I thing so. Keep it up!

Kate Frakloop

<a href="escort-bosnia.com/">escorts sarajevo</a>

Monday, November 07, 2011 2:59 AM by KateFrakloop

Leave a Comment

(required) 
(required) 
(optional)
(required)