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. Pressing Enter Key Throwing on the Home Page

Pressing Enter Key Throwing on the Home Page

Scheduled Pinned Locked Moved ASP.NET
4 Posts 4 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.
  • N Offline
    N Offline
    NET India
    wrote on last edited by
    #1

    Hello Friends, I've designed a contact page for the clients. But as i press Enter key from the keyboard it throws me on the Home Page or Default Page. But it must either save the record or fire the validation if the textboxes are empty. Thnx

    Y V 2 Replies Last reply
    0
    • N NET India

      Hello Friends, I've designed a contact page for the clients. But as i press Enter key from the keyboard it throws me on the Home Page or Default Page. But it must either save the record or fire the validation if the textboxes are empty. Thnx

      Y Offline
      Y Offline
      yogeshpan
      wrote on last edited by
      #2

      yes buddy .. wats u prob make clear... .

      yogesh

      1 Reply Last reply
      0
      • N NET India

        Hello Friends, I've designed a contact page for the clients. But as i press Enter key from the keyboard it throws me on the Home Page or Default Page. But it must either save the record or fire the validation if the textboxes are empty. Thnx

        V Offline
        V Offline
        Vasudevan Deepak Kumar
        wrote on last edited by
        #3

        You ought to trap the button click event and if the event keyCode turns out to be of ENTER key, then invoke the submit button click event.

        Vasudevan Deepak Kumar Personal Homepage
        Tech Gossips
        A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

        N 1 Reply Last reply
        0
        • V Vasudevan Deepak Kumar

          You ought to trap the button click event and if the event keyCode turns out to be of ENTER key, then invoke the submit button click event.

          Vasudevan Deepak Kumar Personal Homepage
          Tech Gossips
          A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

          N Offline
          N Offline
          newc1
          wrote on last edited by
          #4

          The following JS should perform the above operation: function checkEnter(e) {   var characterCode;   if ( e && e.which ) {     e = e;     characterCode = e.which;   }   else {     e = event;     characterCode = e.keyCode;   }   if ( characterCode == 13 ) { // 13 is the ASCII character code for the enter key     document.getElementById('button_id').click();   } } Attach the above function to the body / window elements onkeydown event.

          Clean code is the key to happiness.

          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