INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

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!

Join Tek-Tips
*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.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Turn off "enter key" submit function

Share

Turn off "enter key" submit function

Turn off "enter key" submit function

(OP)
heya,

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 =)

mirirom

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

(OP)
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.. . .

mirirom

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 ..

Srinu...

RE: Turn off "enter key" submit function

(OP)
indeed,

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.

mirirom

RE: Turn off "enter key" submit function

It should work use:

document.formname.action="TargetPage url"
document.formname.method="get" or "post"
document.formname.submit();


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

hope this will work for u..
srinu...

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