How to disable or assign a enter key to a particular group of controls

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vingomail
    New Member
    • Feb 2008
    • 16

    How to disable or assign a enter key to a particular group of controls

    Hi friends

    I want to disable a enter key in my page. Because I m having two submit buttons in my page for two particular group of controls value submission. One group for registration and another for login in the same page itself. Is there anyway control within .net programming or client side javascript? Could you tell me how to assign the particular submit button to a particular set of group controls.



    Advance thanks for your help.
  • balabaster
    Recognized Expert Contributor
    • Mar 2007
    • 798

    #2
    The only way to disable the keypress is to catch it in JavaScript...of course, if the user turns off JavaScript, it will bypass this. So it's not foolproof.

    Code:
    <script type="text/javascript">
        window.onload = function(){
            document.body.onkeypress = function(event){
                var evt = window.event||event;
                if (evt.keyCode = 13){
                    evt.handled = true;
                }
            }            
        }
    </script>

    Comment

    Working...