Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Location
    Los Angeles
    Posts
    617

    enter key - dont submit form, trigger action

    Hello

    I need to trigger a function but do not submit form on enter key within my form. I use the following for calling the function, but it submits and calls the function at the same time.


    <input type="text" name="xxx" onkeypress="entercheck('122');">

    function entercheck(id) {

    if (window.event && window.event.keyCode == 13) {
    sendquery(id);
    }
    return false;

    }

  2. #2
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    3,100
    You need to stop the event. "return false" from function will not do that. Try something like this

    "if ( !entercheck('122') ){return false;}"

  3. #3
    Join Date
    Mar 2004
    Location
    Los Angeles
    Posts
    617
    Worked, thanks

  4. #4
    Join Date
    Nov 2005
    Location
    USA
    Posts
    874
    I think another way is to change it from submit to something else.
    GS RichCopy 360 Enterprise - Voted #1 for data migration and replication in terms of performance and features. Replicate data across between servers in the same network, WAS, or even across the internet

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •