|
-
Oct 27th, 2000, 06:46 AM
#1
Thread Starter
Lively Member
I am confused by something that's happening with some asp pages I am editing.
I effectively just have a search box "frmSearch" and a button "btnSearch" which submits the form.
When I press {ENTER} in "frmSearch" the form is submitted. Why? How can I stop this happening?
Thanks!
-
Oct 27th, 2000, 07:34 AM
#2
Member
I think this is the default behavior for a form when you have a submit button. Perhaps, change the type to button and code an onClick event.
If I could only remember my name...
-
Oct 27th, 2000, 07:37 AM
#3
Thread Starter
Lively Member
Yeah- I meant, when I press {ENTER} in the input box, not press the button.
The button is already a "button" not a "submit".
I have found a workaround for this behaviour though:
Check if they've pressed the {ENTER} key (keycode 13) then cancel the event if necessary.
Code:
sub frmSearch_onkeypress()
if document.theform.frmSearch.value = "" and window.event.keyCode = 13 then '{enter} key pressed with no data in input box
msgbox "You have not entered a search string!",0
window.event.returnValue = false
end if
if window.event.keyCode = 13 then
window.event.returnValue = false
end if
end sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|