[thelist] Focus getting shifted automatically

Christian Heilmann codepo8 at gmail.com
Thu May 5 08:22:42 CDT 2005


> Hello All,
> I'm developing a web application in ASP.NET.
> I have an image button(img1) as first control on page and then a user control that consists of a textbox and image button(img2).
> I have written a handler for text change event of this text box. But as soon as I enter some text in the textbox and press "Enter" key, the image button(img1) click event is fired and the text change event is never fired as page is redirected to another page, on click event of image button(img1). This doesn't happen if "Tab" key is pressed after entering text in textbox, it behaves properly in this case.
> This is very similar to automatically shifting the focus to "Submit" button after entering username, password on any site. Is this inbuilt functionality of textbox? If yes, how can I disable it?
> Please help me ASAP.. The deadline is looming.....

Enter submits the form, as simple as that and you shouldn't stop that
from happening as it would block out keyboard users. The problem is
that you have several submit buttons in one form and enter will always
take the action of the first one. We had a lot of "fun" with this
"feature" of ASP.NET.


-- 
Chris Heilmann 
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/  
Binaries: http://www.onlinetools.org/


More information about the thelist mailing list