Thursday, March 22, 2012

Setting the default button

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,
SeanYou 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/sho...id=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

"Sean" <nospam@.> wrote in message news:uo4Bk35VDHA.452@.TK2MSFTNGP10.phx.gbl...
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,
Sean
Thank You Steve for those valuable links.

"Steve C. Orr, MCSD" <Steve@.Orr.net> wrote in message news:#Kudz$5VDHA.2544@.tk2msftngp13.phx.gbl...
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/sho...id=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

"Sean" <nospam@.> wrote in message news:uo4Bk35VDHA.452@.TK2MSFTNGP10.phx.gbl...
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,
Sean

0 comments:

Post a Comment