I have a login form with the following code...
<form method="post" name="logonform" id="logonform" >
<input type="text"
class="text"
id="username"
name="username"
tabindex="100"
value="<%=(strUserName == null) ? "username" :strUserName %>"
onfocus="if(this.value=='u
sername')t
his.value = ''"
onblur="if(this.value=='')
this.value
='username
'; if(eval(document.logonform
.password)
){if(passw
ord.value=
='Password
'){ makepassword_form(password
Area_form)
; }}"
onkeypress="javascript:ent
erSubmissi
on_form();
"
<%=readOnly%>
/><br/>
<span id="passwordArea_form">
<input type="text"
class="text"
id="password"
name="password"
tabindex="101"
value="Password"
onfocus="if(password.value
=='Passwor
d')makepas
sword_form
(passwordA
rea_form);
"
onkeypress="javascript:ent
erSubmissi
on_form();
"
/>
</span>
<a href="#" onclick="javascript:valida
te();"><im
g src="<%=imageUrl%>" border="0" alt="Login" tabindex="102" ></a><br/>
<img src="<%=imageBlindUrl%>" height="5" alt="" /><br/>
In case the user gives incomplete login information such as he only enters the username and leaves the password as blank, an incompleteLogin page needs to be displayed. When the user clicks on the button after giving incomplete information, an incompleteLogin.jsp page is displayed and focus remains on that page but when user uses the enter key to submit the form, the incomplete login page comes in the background and the main window is displayed. However this happens only for hte first time. If user does the same second time (that is gives incomplete login information and presses enter) the control correctly comes to the incomplete logi page.
Here is the javascript function
function enterSubmission_form(){
if (window.event && window.event.keyCode == 13)
{
if(document.logonform.user
name.value
=='null' || document.logonform.usernam
e.value=='
' || document.logonform.usernam
e.value=='
username' || document.logonform.passwor
d.value=='
' || document.logonform.passwor
d.value=='
null' || document.logonform.passwor
d.value=='
Password')
{
document.logonform.usernam
e.focus();
window.open(setCurrentCont
extLogin+"
/controlle
r?action=i
ncompletel
ogin",'inc
omplete_Lo
gin','tool
bar=0,scro
llbars=1,s
tatusbar=0
,menubar=0
,resizable
=0,width=6
00,height=
400',"Inco
mpleteLogi
n");
}
else {
validate();
}
}
}
Thanks