Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Turn off "enter key" submit function

Turn off "enter key" submit function

Turn off "enter key" submit function


i'm working on an .asp form using 2 submit buttons.  it'd be great if i could remove IE's functionality of automatically calling the 1st "submit" button found when the enter key is presseed - thereby forcing the user to click/choose a selection.

is there any way to do this?  i've read a few posts about forcing a default from one button to another, however, this kind of fix really isn't applicable to my situation (no default can be realistically determined).   

any suggestions are appreciated!  thanks =)


RE: Turn off "enter key" submit function

try to use in the onkeydown or in the onkeypress event of the first button the following:
sub submit1_onclick
 window.event.cancelBubble =true
end sub
sub submit1_onkeydown
 window.event.cancelBubble =true
end sub

George, M

RE: Turn off "enter key" submit function

hi shaddow,

tx for your reply.  tried implementing your suggestion and unfortunately, it didn't work.  the events were called correctly, however, the
window.event.cancelBubble = true
method didn't do anything.  perhaps i'm missing something?  sorry for my ignorance; i'm new to web programming and my familiarity with the various object collections is less than desireable.. . .


RE: Turn off "enter key" submit function

Hey if u want user to click on button to submit the form then why r u using the submit buttons .. use normal buttons and submit the for only when he clicks it..

Hope this helps ..


RE: Turn off "enter key" submit function


i changed the input type of one of the "submit" items to "button", then overloaded the object_onClick event.  interesting note though:  the form.action and form.submit methods do not work with the onClick event.  however, window.navigate does --- provided that elements of the QueryString are passed with the URL (e.g. window.navigate "//someDir/somePage.asp?control=" & _ form.control.value

thanks for your input again.


RE: Turn off "enter key" submit function

It should work use:

document.formname.action="TargetPage url"
document.formname.method="get" or "post"

this will submit the form if u include it in button click.

hope this will work for u..

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close