By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,404 Members | 2,145 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,404 IT Pros & Developers. It's quick & easy.

button click wrongly firing on login page with client script 4 "en

P: n/a
I'm having a problem with a button click event being fired erroneously.

My login.aspx page has the usual username/password boxes.
There is also a link to click when you have filled these, plus a 'remember
me' checkbox.

Further down the page we have a 'email me my password' button.

In addition there is also a small piece of client side script to handle the
user pressing the 'enter' key (this has the same effect as clicking the
'login' link)

What I want to know is - why is the 'email pwd' button event being fired
when the user hits enter?

here is the client script:
==start script
<script language="VBScript">
sub Document_onKeyDown()
if window.event.keyCode = 13 then
Login.submit()
window.event.returnValue=true
end if
end sub

</script>
==end script
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hitting enter is always the same as clicking the first submit button.

http://www.allasp.net/enterkey.aspx

Eliyahu

"adolf garlic" <ad*********@discussions.microsoft.com> wrote in message
news:4A**********************************@microsof t.com...
I'm having a problem with a button click event being fired erroneously.

My login.aspx page has the usual username/password boxes.
There is also a link to click when you have filled these, plus a 'remember
me' checkbox.

Further down the page we have a 'email me my password' button.

In addition there is also a small piece of client side script to handle the user pressing the 'enter' key (this has the same effect as clicking the
'login' link)

What I want to know is - why is the 'email pwd' button event being fired
when the user hits enter?

here is the client script:
==start script
<script language="VBScript">
sub Document_onKeyDown()
if window.event.keyCode = 13 then
Login.submit()
window.event.returnValue=true
end if
end sub

</script>
==end script

Nov 19 '05 #2

P: n/a
When you set the event returnValue to true, you are allowing the keydown to
continue propagating up the chain. So you are submitting, then you are
hitting your email pwd button.

Try changing the returnValue to false and see if that works.

HTH,

bill

"adolf garlic" <ad*********@discussions.microsoft.com> wrote in message
news:4A**********************************@microsof t.com...
I'm having a problem with a button click event being fired erroneously.

My login.aspx page has the usual username/password boxes.
There is also a link to click when you have filled these, plus a 'remember
me' checkbox.

Further down the page we have a 'email me my password' button.

In addition there is also a small piece of client side script to handle the user pressing the 'enter' key (this has the same effect as clicking the
'login' link)

What I want to know is - why is the 'email pwd' button event being fired
when the user hits enter?

here is the client script:
==start script
<script language="VBScript">
sub Document_onKeyDown()
if window.event.keyCode = 13 then
Login.submit()
window.event.returnValue=true
end if
end sub

</script>
==end script

Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.