473,408 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Enter Key envoking button without being over it

Hi,

HELP!!!! we are having a problem where we have a web page
with a number of buttons and form fields, unfortunately
whenevr we hit the enter key in a form field it is
envokingthe 1st button, WHY??? this is a major issue for
us please help......
Nov 17 '05 #1
2 1292
Hi Phillip,

Based on my research and experience, I would like to share the following
information with you.

IE has some unexpected behavior when a user presses "Enter" in a textbox.

When a user presses enter with the cursor inside of a textbox, if there is
some kind of a button on the form, IE will automatically post the page.
However, the type of postback depends on how many textboxes are present.

If there is only one textbox, IE will post the page without clicking the
button. In terms of postback data, this means that no post data is sent
for the button. On the server, it looks like the button was never clicked,
and therefore no event handler is fired.

If there is more than one textbox, IE chooses the first button on the form
and magically clicks it. Again, in terms of postback data, this means
postback data is sent for the button, something like "button1=button1" On
the server we detect that the button was clicked and fire the event.

Please tell me what the behavior you really want is. Then we can try to
find a work around.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #2
You can intercept the client side enter keypress event of the text box and
then click the correct button using javascript code.
Here's a good example:
http://www.kamp-hansen.dk/pages/show...d=21&menuid=18

You could also try using this free control.
http://www.metabuilders.com/tools/DefaultButtons.aspx

And here's a good article on the subject:
http://www.allasp.net/enterkey.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Phillip Kennedy" <ph*************@rslcommobile.com.au> wrote in message
news:50****************************@phx.gbl...
Hi,

HELP!!!! we are having a problem where we have a web page
with a number of buttons and form fields, unfortunately
whenevr we hit the enter key in a form field it is
envokingthe 1st button, WHY??? this is a major issue for
us please help......

Nov 17 '05 #3

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

Similar topics

15
by: M Smith | last post by:
I have a form I want to submit to itself. I want to be able to type in a list of numbers and submit the form and have that list show up on the same form under the text box I typed them into and...
3
by: felecha | last post by:
I'm something of a rookie at .Net. I know I can set TabIndex for controls in a GroupBox, and tab my way over to a button so it's "Active" and will be clicked by hitting the Enter key. But isn't...
15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
3
by: Eric D. Braden | last post by:
I feel like a fool for asking this; seems like I would have had more luck with Google, but alas... This is a little baby bit of code that a friend cooked up over a year ago. My problem is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.