473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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
2 1924
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Matt | last post by:
In ASP page, there is a "SELECT ALL" button, when user click it, it will select all checkboxes. I am not sure should I use client-side code to do that? the following is my approach but it didnt...
3
by: IntraRELY | last post by:
I need to attach the following 2 little scripts to an ASP.NET Button. I am having an issue with running both of the Attributes.Add. I can only get on to work at once. I have also tried to put them...
4
by: nicholas | last post by:
Weird thing: Got an aspx page with a button and an associated code in VB.net. On my testing server the page works fine. On the old hosters server the page worked fine too. But now, at the new...
1
by: mensuur | last post by:
hi, have you ever tried windows live mail? they ave right click functions. you right click en email message and it comes up with options like 'delete' or 'reply'. anyway, i was wondering how it...
37
by: Jan Wagner | last post by:
Hi, can't figure this one out, what's the CSS way to specify the language? In HTML it would be simply an lang="xx" attribute, or XHTML xml:lang="xx", but, how about in CSS? This would be...
2
by: Cristobal | last post by:
Hola tengo un problemilla, necesito saber que evento es llamado al hacer click sobre una de las filas del gridview. Lo necesito para poder sobreescribirlo y hacer una redirección dentro de él. ...
0
by: =?Utf-8?B?RXJpayBBZGFz?= | last post by:
Hi. Recently I installed an intranet application in asp pages and sql server 2000. In some pages there are dream weaver buttons. The problem is that in customer installations the buttons work...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.