By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,012 Members | 988 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,012 IT Pros & Developers. It's quick & easy.

Setting default button

P: n/a
Hi,
I have a page with 2 textboxes(Name and Surname) and two
buttons(Submit and Reset).

Now I have set the tab for them
1 Name
2 Surname
3 Submit
4 Reset

Now I am entering the name, entering the surname and while I am on the
surname I press Enter and the Reset button is being pressed.

How can I change it so that by default the Submit button is pressed
instead.

Can someone help me out please.
Thanks in Advance
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Enter activates the first submit button in the layout. See details at
http://www.allasp.net/enterkey.aspx

Eliyahu

"Xarky" <be*********@yahoo.com> wrote in message
news:bc*************************@posting.google.co m...
Hi,
I have a page with 2 textboxes(Name and Surname) and two
buttons(Submit and Reset).

Now I have set the tab for them
1 Name
2 Surname
3 Submit
4 Reset

Now I am entering the name, entering the surname and while I am on the
surname I press Enter and the Reset button is being pressed.

How can I change it so that by default the Submit button is pressed
instead.

Can someone help me out please.
Thanks in Advance

Nov 19 '05 #2

P: n/a
It isn't the label that defines a button. It's the type. Example:

<input type="submit" value="Reset">

Makes a Submit button with the label "Reset".

<input type="reset" value="Submit">

Makes a Reset button with the label "Submit".

<input type="button" value="Click Me">

Makes a normal button that has a label "Click Me" and does nothing when
clicked, as it has no "onclick" event handler.

Now, a browser will, by default submit a form when you press the ENTER key.
So, it all depends on what type of buttons you're using, which one gets the
event handler.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Xarky" <be*********@yahoo.com> wrote in message
news:bc*************************@posting.google.co m...
Hi,
I have a page with 2 textboxes(Name and Surname) and two
buttons(Submit and Reset).

Now I have set the tab for them
1 Name
2 Surname
3 Submit
4 Reset

Now I am entering the name, entering the surname and while I am on the
surname I press Enter and the Reset button is being pressed.

How can I change it so that by default the Submit button is pressed
instead.

Can someone help me out please.
Thanks in Advance

Nov 19 '05 #3

P: n/a
You could use this free control to solve the problem.
http://www.metabuilders.com/tools/DefaultButtons.aspx

And here are a couple good articles on the subject:
http://www.allasp.net/enterkey.aspx
http://www.aspnetpro.com/features/20...200406so_f.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Xarky" <be*********@yahoo.com> wrote in message
news:bc*************************@posting.google.co m...
Hi,
I have a page with 2 textboxes(Name and Surname) and two
buttons(Submit and Reset).

Now I have set the tab for them
1 Name
2 Surname
3 Submit
4 Reset

Now I am entering the name, entering the surname and while I am on the
surname I press Enter and the Reset button is being pressed.

How can I change it so that by default the Submit button is pressed
instead.

Can someone help me out please.
Thanks in Advance

Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.