how to disable post back if enter key is pressed on th form

Discussion in 'ASP .Net' started by gh0st54, Sep 27, 2004.

  1. gh0st54

    gh0st54 Guest

    what i mean is is it possible to cancel a postback if the visitor
    presses the enter key while no text box control, check box control ,
    etc ... has the focus

    here is the script i'm using

    function document.onkeydown()
    {

    if(event.keyCode ==13){
    event.returnvalue=false;
    event.cancel =true;

    }
    }

    this still posts back to the server
     
    gh0st54, Sep 27, 2004
    #1
    1. Advertisements

  2. gh0st54

    Guest Guest

    hi,
    use event.returnValue = false. note the 'V' caps.
    HTH
    srini
     
    Guest, Sep 27, 2004
    #2
    1. Advertisements

  3. gh0st54

    gh0st54 Guest

    Thanks

    I hate those case sensitive errors.
     
    gh0st54, Sep 27, 2004
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.