Setting the default button

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.
 
S

Steve C. Orr, MCSD

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.
 
S

Sean

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top