Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Turn off "enter key" submit function

Status
Not open for further replies.

mirirom

Programmer
Jul 21, 2001
110
US
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
 
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
 
hi shaddow,

tx for your reply. tried implementing your suggestion and unfortunately, it didn't work. the events were called correctly, however, the
Code:
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
 
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...
 
indeed,

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

thanks for your input again.

mirirom
 
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...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top