Default submit
-
Hi I know its probably pretty simple... but... I have a page with one HTMLForm on it. This form has one table in it. This table has several textboxes and several buttons. Once the page loads, pressing enter causes the first button on the page to click. Obviously this button has focus on startup. I do not want this to happen.Pressing the enter button just after startup should not do anything I have tried removing this focus to the table but this has not helped. I do not wish to set the focus to one of the textboxes since these are loaded dynamically. Does any one have any ideas?? Thanks
-
Hi I know its probably pretty simple... but... I have a page with one HTMLForm on it. This form has one table in it. This table has several textboxes and several buttons. Once the page loads, pressing enter causes the first button on the page to click. Obviously this button has focus on startup. I do not want this to happen.Pressing the enter button just after startup should not do anything I have tried removing this focus to the table but this has not helped. I do not wish to set the focus to one of the textboxes since these are loaded dynamically. Does any one have any ideas?? Thanks
By default, the enter key posts back firing the on_click event of the first button in the HTML code, not the first button appearing on the page. I believe the only way around this is to use scripting to capture the enter key being pressed and instead of sending this key to the client send the tab key or similar. Do you follow? Rhys Gravell
-
Hi I know its probably pretty simple... but... I have a page with one HTMLForm on it. This form has one table in it. This table has several textboxes and several buttons. Once the page loads, pressing enter causes the first button on the page to click. Obviously this button has focus on startup. I do not want this to happen.Pressing the enter button just after startup should not do anything I have tried removing this focus to the table but this has not helped. I do not wish to set the focus to one of the textboxes since these are loaded dynamically. Does any one have any ideas?? Thanks
IE will treat the "Enter" button as submitting the form ... that is its nature. What I have found is that if there is even one button (that is an
INPUT
of typeSUBMIT
) the "Enter" button can be an annoying feature to handle because of this nature. You can avoid this by making the buttons of typeBUTTON
but this is probably not a good viable option because I would assume that you are using the Web Controlasp:Button
which is of typeSUBMIT
. So, using javascript to capture the keydown, or keyup, or keypress event(s) is probably going to be your best method of blocking this "feature".Wally Atkins
Newport News, VA, USA