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. Default submit

Default submit

Scheduled Pinned Locked Moved ASP.NET
question
3 Posts 3 Posters 1 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.
  • U Offline
    U Offline
    User 702876
    wrote on last edited by
    #1

    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

    R D 2 Replies Last reply
    0
    • U User 702876

      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

      R Offline
      R Offline
      Rhys__666
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • U User 702876

        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

        D Offline
        D Offline
        DFU23
        wrote on last edited by
        #3

        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 type SUBMIT) the "Enter" button can be an annoying feature to handle because of this nature. You can avoid this by making the buttons of type BUTTON but this is probably not a good viable option because I would assume that you are using the Web Control asp:Button which is of type SUBMIT. 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

        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