Hello,
I'm using a Login Control on asp.net 2.0 website and it works fine on
IE & Firefox, however I have recently added a javscript function to
listen for a 'return-key-click' and am encountering problems with
Firefox.
If the user clicks the 'Login' button with a mouse button click, it
works fine, however if the user hits enter, the form fields are
cleared and the user is not logged in.
Please note, this only happens if the user has 'remember passwords'
checked in their Firefox preferences.
Thanks for your time,
Max
//attached javascript:
var objLogin = {
controls : document.getElementsByTagName('input'),
loginButton : null,
userName : null,
password : null,
init : function(){
for (var i=0;i<objLogin.controls.length;i++)
{
if (objLogin.controls[i].type == 'image')
{
objLogin.loginButton = objLogin.controls[i];
}
else if
(objLogin.controls[i].getAttribute('id').indexOf('LoginView1_Login1_Use rName')>=0)
{
objLogin.userName = objLogin.controls[i];
objLogin.addEvent(objLogin.userName, "keydown",
objLogin.setDefault);
}
else if
(objLogin.controls[i].getAttribute('id').indexOf('LoginView1_Login1_Pas sword')>=0)
{
objLogin.password = objLogin.controls[i];
objLogin.addEvent(objLogin.password,"keydown",
objLogin.setDefault);
}
else if
(objLogin.controls[i].getAttribute('id').indexOf('LoginView1_Login1_Rem emberMe')>=0)
{
objLogin.password = objLogin.controls[i];
objLogin.addEvent(objLogin.password,"keydown",
objLogin.setDefault);
}
}
},
setDefault : function(e){
if (!e) var e=window.event;
if (e.keyCode == 13)
{
if (e.stopPropagation)
{
e.stopPropagation();
e.preventDefault();
}
else
{
e.returnValue=false;
e.cancel = true;
}
if (objLogin.loginButton!=null)
objLogin.loginButton.click();
}
},
addEvent : function(obj, evType, fn){
if (obj.addEventListener)
{
obj.addEventListener(evType, fn, false);
return true;
}
else if (obj.attachEvent)
{
var r = obj.attachEvent("on"+evType, fn);
return r;
}
else
{
return false;
}
}
} 2 1772
i don't see anything obvious, but you are canceling the current event
and firing a new one. i change:
objLogin.loginButton.click();
to
window.setTimeout(function(){objLogin.loginButton. click();});
also asp.net has a built set default button function you could use
instead (see panel).
-- bruce (sqlwork.com) md****@medelect.co.uk wrote:
Hello,
I'm using a Login Control on asp.net 2.0 website and it works fine on
IE & Firefox, however I have recently added a javscript function to
listen for a 'return-key-click' and am encountering problems with
Firefox.
If the user clicks the 'Login' button with a mouse button click, it
works fine, however if the user hits enter, the form fields are
cleared and the user is not logged in.
Please note, this only happens if the user has 'remember passwords'
checked in their Firefox preferences.
Thanks for your time,
Max
//attached javascript:
var objLogin = {
controls : document.getElementsByTagName('input'),
loginButton : null,
userName : null,
password : null,
init : function(){
for (var i=0;i<objLogin.controls.length;i++)
{
if (objLogin.controls[i].type == 'image')
{
objLogin.loginButton = objLogin.controls[i];
}
else if
(objLogin.controls[i].getAttribute('id').indexOf('LoginView1_Login1_Use rName')>=0)
{
objLogin.userName = objLogin.controls[i];
objLogin.addEvent(objLogin.userName, "keydown",
objLogin.setDefault);
}
else if
(objLogin.controls[i].getAttribute('id').indexOf('LoginView1_Login1_Pas sword')>=0)
{
objLogin.password = objLogin.controls[i];
objLogin.addEvent(objLogin.password,"keydown",
objLogin.setDefault);
}
else if
(objLogin.controls[i].getAttribute('id').indexOf('LoginView1_Login1_Rem emberMe')>=0)
{
objLogin.password = objLogin.controls[i];
objLogin.addEvent(objLogin.password,"keydown",
objLogin.setDefault);
}
}
},
setDefault : function(e){
if (!e) var e=window.event;
if (e.keyCode == 13)
{
if (e.stopPropagation)
{
e.stopPropagation();
e.preventDefault();
}
else
{
e.returnValue=false;
e.cancel = true;
}
if (objLogin.loginButton!=null)
objLogin.loginButton.click();
}
},
addEvent : function(obj, evType, fn){
if (obj.addEventListener)
{
obj.addEventListener(evType, fn, false);
return true;
}
else if (obj.attachEvent)
{
var r = obj.attachEvent("on"+evType, fn);
return r;
}
else
{
return false;
}
}
}
Hi, I would like to force postback when retunr key is pressed but I don't
found the property to do this.
What you mean about "see panel" ??
thanks.
"bruce barker" <no****@nospam.comwrote in message
news:e%****************@TK2MSFTNGP03.phx.gbl...
>i don't see anything obvious, but you are canceling the current event and firing a new one. i change:
objLogin.loginButton.click();
to
window.setTimeout(function(){objLogin.loginButton. click();});
also asp.net has a built set default button function you could use instead
(see panel).
-- bruce (sqlwork.com)
md****@medelect.co.uk wrote:
>Hello, I'm using a Login Control on asp.net 2.0 website and it works fine on IE & Firefox, however I have recently added a javscript function to listen for a 'return-key-click' and am encountering problems with Firefox. If the user clicks the 'Login' button with a mouse button click, it works fine, however if the user hits enter, the form fields are cleared and the user is not logged in. Please note, this only happens if the user has 'remember passwords' checked in their Firefox preferences.
Thanks for your time, Max
//attached javascript:
var objLogin = { controls : document.getElementsByTagName('input'), loginButton : null, userName : null, password : null, init : function(){ for (var i=0;i<objLogin.controls.length;i++) { if (objLogin.controls[i].type == 'image') { objLogin.loginButton = objLogin.controls[i]; } else if (objLogin.controls[i].getAttribute('id').indexOf('LoginView1_Login1_Use rName')>=0) { objLogin.userName = objLogin.controls[i]; objLogin.addEvent(objLogin.userName, "keydown", objLogin.setDefault); } else if (objLogin.controls[i].getAttribute('id').indexOf('LoginView1_Login1_Pas sword')>=0) { objLogin.password = objLogin.controls[i]; objLogin.addEvent(objLogin.password,"keydown", objLogin.setDefault); } else if (objLogin.controls[i].getAttribute('id').indexOf('LoginView1_Login1_Rem emberMe')>=0) { objLogin.password = objLogin.controls[i]; objLogin.addEvent(objLogin.password,"keydown", objLogin.setDefault); } } }, setDefault : function(e){ if (!e) var e=window.event;
if (e.keyCode == 13) { if (e.stopPropagation) { e.stopPropagation(); e.preventDefault(); } else { e.returnValue=false; e.cancel = true; } if (objLogin.loginButton!=null) objLogin.loginButton.click(); } }, addEvent : function(obj, evType, fn){ if (obj.addEventListener) { obj.addEventListener(evType, fn, false); return true; } else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } } This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ghazan Haider |
last post by:
I am posting this for the lack of a better newsgroup, and for the
knowledge of people here, and because its only partially OT.
We have a bunch of users with their computers at work. There are...
|
by: Steve Commisso |
last post by:
I'm trying to create a forked login where users of certain roles will be
redirected to specific pages.
The easy way to do this would be to do the redirecting in the
Page_Load() of the default...
|
by: Atul Chaturvedi |
last post by:
If we use ASP.NET 2.0 Login Control, we are unable to click on Login and
Reset Buttons on Safari running on Apple Mac OS X Version 10.3.2 .
How can i resolve the problem.
|
by: goot |
last post by:
I'm trying to use the login control and have it use the membership
provider framework to authenticate users and am having a problem (which
i'm sure will turn out to be a stupid mistake on my...
|
by: AppleBag |
last post by:
I'm having the worst time trying to login to myspace through code. Can
someone tell me how to do this? Please try it yourself before replying,
only because I have asked this a couple of times in...
|
by: barrybevel |
last post by:
Hi,
I'm trying to login to the www.vodafone.ie website using
HttpWebRequest.
It works fine with IE/Firefox and the .NET Web Control too, just not
with my code.
I think it's a redirect 302...
|
by: =?Utf-8?B?U2hhbm5vbg==?= |
last post by:
I am trying to publish an application to a server that I do not have desktop
access to because of our hosting environment. I publish to a file share.
The WEB site has been configured by the hosts...
|
by: SF |
last post by:
Hi,
I am nes to ASP.NET. I try to develop on online form for my office that
requiore use to login using Windows Authentication (Use name active
directory). I am search to web and could not found...
|
by: DavidPr |
last post by:
When I logout as one user and log in under a different user, it opens with the last user's information.
User 1 - Unsername: Davey Jones
User 2 - Unsername: David Smith
I log out from Davey...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |