Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Apr 2009
    Location
    Earth - sometimes sky :-)
    Posts
    121
    Thanks
    51
    Thanked 2 Times in 2 Posts

    How to disable "ENTER" key from executing the form?

    Hi!
    how can I disable the "ENTER" key to execute the form to submitting?
    If the user have some input boxes and if he/she push the "ENTER" key it should not execute the form, it should focus the next input box or should do nothing.

    Is it possible with php or maybe with java?

    Thanks a lot for any advice.

  • #2
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    replace submit with button:
    Code:
    <input type="button" value="Submit" onclick="this.form.submit()" />

  • Users who have thanked poyzn for this post:

    joda (11-20-2010)

  • #3
    Regular Coder
    Join Date
    Apr 2009
    Location
    Earth - sometimes sky :-)
    Posts
    121
    Thanks
    51
    Thanked 2 Times in 2 Posts
    Thank you.
    This solved my problem.

    Thank you for your time.

  • #4
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,546
    Thanks
    45
    Thanked 259 Times in 256 Posts
    To be clear, this is neither PHP or Java, but Javascript. People confuse Java and Javascript a lot, but they are very different, the former being a scripting language.


  •  

    Posting Permissions

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