no keypressed event.. uh oh!
-
Hey there. I am having a problem in that on my web form hitting the enter key is equal to clicking the submit button on the webform. I have a series of text boxes on the page that the use enters in transactional information and I would like the enter key to either jump to the next text box or do nothing at all. I know with a windows app I would use the Keypressed method, but the webform control obviously is missing this method. How do I go about fixing this anyone? Oh yeah I am using VB.NET Thanks.
-
Hey there. I am having a problem in that on my web form hitting the enter key is equal to clicking the submit button on the webform. I have a series of text boxes on the page that the use enters in transactional information and I would like the enter key to either jump to the next text box or do nothing at all. I know with a windows app I would use the Keypressed method, but the webform control obviously is missing this method. How do I go about fixing this anyone? Oh yeah I am using VB.NET Thanks.
In a web form ( like a windows program by default ), tab is the key to go between fields. It's possible to write some javascript to catch keypresses and change your default behaviour ( and javascript is the only code that runs on the client, so it's your only option ). However, you should stick to the behaviour your users are used to, if at all possible, and certainly avoid jscript if you can as well, because different browsers will require different scripts. Christian Graus - Microsoft MVP - C++
-
In a web form ( like a windows program by default ), tab is the key to go between fields. It's possible to write some javascript to catch keypresses and change your default behaviour ( and javascript is the only code that runs on the client, so it's your only option ). However, you should stick to the behaviour your users are used to, if at all possible, and certainly avoid jscript if you can as well, because different browsers will require different scripts. Christian Graus - Microsoft MVP - C++
So then I am better off disabling the enter key then? There are 15 fields that have to be entered, though some of them may quite possibly remain at their default value (0). I would hate to have a user get to field 13 and hit enter accidently and have to begin all over again. Is there an easy way to disable the enter key or change this default behaviour without java scripting it? I too would love to avoid java if at all possible.
-
So then I am better off disabling the enter key then? There are 15 fields that have to be entered, though some of them may quite possibly remain at their default value (0). I would hate to have a user get to field 13 and hit enter accidently and have to begin all over again. Is there an easy way to disable the enter key or change this default behaviour without java scripting it? I too would love to avoid java if at all possible.
Just put required field validators on all required fields, then the page won't post back. I'm sure there's a solution to the autopostback on return tho, I just don't know what it is off hand. But the validators will definately help make sure all fields are entered, all the same. Christian Graus - Microsoft MVP - C++
-
Hey there. I am having a problem in that on my web form hitting the enter key is equal to clicking the submit button on the webform. I have a series of text boxes on the page that the use enters in transactional information and I would like the enter key to either jump to the next text box or do nothing at all. I know with a windows app I would use the Keypressed method, but the webform control obviously is missing this method. How do I go about fixing this anyone? Oh yeah I am using VB.NET Thanks.