Setting the default button

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

hi,

i have a webform, which has a couple of formfields including a couple of buttons too.

the webform structure is
textbox1
button1
button2
textbox2
button3 - submit

How do i trap when the focus on textbox2 , so i could set the enable property of button1 and button2 to be false, so the Submit would work, when the Enter Key is pressed.

Any suggestion is welcomed and appreciated.
 
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/showdoc.asp?id=28&menuid=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
http://Steve.Orr.net

hi,

i have a webform, which has a couple of formfields including a couple of buttons too.

the webform structure is
textbox1
button1
button2
textbox2
button3 - submit

How do i trap when the focus on textbox2 , so i could set the enable property of button1 and button2 to be false, so the Submit would work, when the Enter Key is pressed.

Any suggestion is welcomed and appreciated.
 
Thank You Steve for those valuable links.


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/showdoc.asp?id=28&menuid=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
http://Steve.Orr.net

hi,

i have a webform, which has a couple of formfields including a couple of buttons too.

the webform structure is
textbox1
button1
button2
textbox2
button3 - submit

How do i trap when the focus on textbox2 , so i could set the enable property of button1 and button2 to be false, so the Submit would work, when the Enter Key is pressed.

Any suggestion is welcomed and appreciated.
 
Back
Top