DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Enter Key to Post forms?

  1. #1
    Join Date
    Aug 2005
    Posts
    4

    Enter Key to Post forms?

    Hi

    how do I get the Enter key by default to post the form?

    Because now in .NET there is so much form submitting, how do you set a default action to hitting the Enter key?

    Regards

    Steve

  2. #2
    Join Date
    Dec 2004
    Posts
    717
    In <body>,
    onkeypress='if(window.event.keyCode==13){ event.returnValue=false;event.cancel = true;}
    In Search Textbox,
    onKeyDown="KeyDownHandler(BtnSearch)"
    function KeyDownHandler(btn){
    // process only the Enter key
    if (event.keyCode == 13)
    {
    // cancel the default submit
    event.returnValue=false;
    event.cancel = true;
    // submit the form by programmatically clicking the specified button
    btn.click();
    }
    }
    I hope you can got some ideas if you change somethings in my code....
    Best Regards,
    Michael Sync
    http://michaelsync.net

    The more you share,The more you get

  3. #3
    Join Date
    Aug 2005
    Posts
    4
    <body MS_POSITIONING="FlowLayout" onkeypress="if(window.event.keyCode==13){ document.all.btnSearch.click();}">

    beauty! thanks

Similar Threads

  1. Problem in using ENTER KEY in .NET
    By Mishra N K in forum ASP.NET
    Replies: 1
    Last Post: 09-02-2003, 11:19 AM
  2. Enter Key Bug in UserControl?
    By Jim Pragit in forum .NET
    Replies: 2
    Last Post: 03-31-2002, 12:51 PM
  3. MS Access - Remove Enter Key from the data
    By SiaoWei in forum VB Classic
    Replies: 1
    Last Post: 06-22-2001, 12:22 AM
  4. Enter Key Disabling/Form Validation
    By Mike Ewert in forum Web
    Replies: 3
    Last Post: 06-20-2001, 12:00 PM
  5. Submit form with Enter key?
    By comdna in forum ASP.NET
    Replies: 2
    Last Post: 02-22-2001, 11:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center