Dear Friends,
I am trying to validate userID and password with javaScript. I am comparing the userid user entered with the ones in the database. Can anyone there check my logic? Iam using Microsoft Interdev and Personal Web server. Why does it say Reqest undefined? What should I do?
Thanks.
function invalidForm(passForm) {
if (passForm.userid.value == "") {
alert("You must enter a userid")
passForm.userid.focus()
return false
}
if (passForm.password.value == "") {
alert("You must enter a password")
passForm.password.focus()
return false
}
// Get the user-entered username and password
userid=Request.Form("userid")
password=Request.Form("password")
// Set the SQL
String /*var sqlstring = "SELECT userid, password FROM USERS WHERE userid = '" + userid + "'"
rsLogin.setSQLText(sqlstring)
//Open the recordset
rsLogin.open()
if (rsLogin.EOF) {
Alert("invalidusername")
}
if (Trim(rsLogin.fields.getValue("password"))=Trim(password) {
Response.Redirect("home.asp")
}
else {Alert ("invalidpassword")
}
// Close the recordset
rsLogin.close()
}