Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. no keypressed event.. uh oh!

no keypressed event.. uh oh!

Scheduled Pinned Locked Moved ASP.NET
questioncsharphelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SiliconScout
    wrote on last edited by
    #1

    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.

    C D 2 Replies Last reply
    0
    • S SiliconScout

      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.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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++

      S 1 Reply Last reply
      0
      • C Christian Graus

        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++

        S Offline
        S Offline
        SiliconScout
        wrote on last edited by
        #3

        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.

        C 1 Reply Last reply
        0
        • S SiliconScout

          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.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          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++

          1 Reply Last reply
          0
          • S SiliconScout

            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.

            D Offline
            D Offline
            d_vaibhav
            wrote on last edited by
            #5

            hi, if u want to avoide postback after press of enter key, you can avoide using input type as submit. u can use the following tag. this will atleast restrict the enter key behavior. regards, vaibhav.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups