P
Purvi T
Hi,
I am trying to do the enter-key capture in an aspx page. Since I wanted to
use a common function in all my forms, I wrote a function as shown. I call
this function on the textbox onkeydown by adding attribute as follows in the
c# code behind file.
txtUserID.Attributes.Add("onkeydown","LoginEnter(event,'btnLogin')");
The problem arises when the autofill option of forms is on in IE Browser. In
this case, after i use the arrow key to go to the option i want (from the
autofill entries that appear) and press enter, the function gets called. The
selected text does not appear in the text box.
I need to capture enter keys but without the occurence of the above problem.
Please help.
//***************************Start
function LoginEnter(ctrlName)
{
var keycode;
if (window.event)
{
keycode = window.event.keyCode;
}
if (keycode == 13)
{
document.getElementById(ctrlName).click();
}
event.returnValue = false;
}
}
//***************************End
Purvi
I am trying to do the enter-key capture in an aspx page. Since I wanted to
use a common function in all my forms, I wrote a function as shown. I call
this function on the textbox onkeydown by adding attribute as follows in the
c# code behind file.
txtUserID.Attributes.Add("onkeydown","LoginEnter(event,'btnLogin')");
The problem arises when the autofill option of forms is on in IE Browser. In
this case, after i use the arrow key to go to the option i want (from the
autofill entries that appear) and press enter, the function gets called. The
selected text does not appear in the text box.
I need to capture enter keys but without the occurence of the above problem.
Please help.
//***************************Start
function LoginEnter(ctrlName)
{
var keycode;
if (window.event)
{
keycode = window.event.keyCode;
}
if (keycode == 13)
{
document.getElementById(ctrlName).click();
}
event.returnValue = false;
}
}
//***************************End
Purvi