Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Help!help!Help!

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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()
}
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I may be way off base but could it be because you capitalized request maybe userid=request.Form("userid") will work.
also is Form the name you gave to the html form object?
I dont know js very well and dont know server side js at all really(I like java better), but i did read that js is case sensitive.
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can see only one error. It's:
if (Trim(rsLogin.fields.getValue("password"))=Trim(password)
you use a single = instead of a double == and the parenthesis ending the condition. A single = is the symbol of affectation and a double = the symbol of equality
 
Michael.H.Sun
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Randall and Xavier;
Thank you both for the responses. I will try what you said . Have a good day.
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Michael,
I guess you have combined Javascript with ASP? I mean client side script and server side script.
The browser(client) will not understand the 'request' object.
[This message has been edited by swaroop shastri (edited August 15, 2001).]
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Technically, ASP is only an application of JavaScript (or VBScript). JavaScript is the default on the client and VBScript is the default for IIS server-side code. However, either can be used in either situation. The only thing that ASP really brings to the table is an API for server functions that you can access with JavaScript or VBScript.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic