File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Help!help!Help! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Help!help!Help!" Watch "Help!help!Help!" New topic


Ranch Hand

Joined: Jan 18, 2001
Posts: 39
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?
function invalidForm(passForm) {

if (passForm.userid.value == "") {
alert("You must enter a userid")
return false

if (passForm.password.value == "") {
alert("You must enter a password")
return false

// Get the user-entered username and password
// Set the SQL String
/*var sqlstring = "SELECT userid, password FROM USERS WHERE userid = '" + userid + "'"
//Open the recordset
if (rsLogin.EOF) {

if (Trim(rsLogin.fields.getValue("password"))=Trim(password) {
else {Alert ("invalidpassword")

// Close the recordset
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4351

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.

Visit my download page
xavier romea
Ranch Hand

Joined: Jun 28, 2001
Posts: 37
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
Ranch Hand

Joined: Jan 18, 2001
Posts: 39
Dear Randall and Xavier;
Thank you both for the responses. I will try what you said . Have a good day.
swaroop shastri
Ranch Hand

Joined: Aug 15, 2001
Posts: 65
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

Joined: Nov 22, 2008
Posts: 18944
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.
I agree. Here's the link:
subject: Help!help!Help!
It's not a secret anymore!