Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


simple form validation help

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,59063
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> simple form validation help
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 simple form validation help - 4/13/2008 3:43:31 PM   
  need_helpp

 

Posts: 1
Score: 0
Joined: 4/13/2008
Status: offline
I highlighted my error in bold, wonder if any kind person can help me solve this, i just started in vb, thanks a lot for the help

1) how to string concate my strUser
2)when i use msgbox (StrPassword)......it prints Document.form1.password1 and not the password i entered


<html>
<head>


<SCRIPT LANGUAGE="VBScript">

Option Explicit
ON ERROR RESUME NEXT

Dim strUser, strPassword

function login()

strUser = "testdomain\" + "Document.form1.userName"
strPassword = "Document.form1.password1"
msgbox(strPassword)


end function
</Script>


</head>


<body>

<form name="form1" id="form1">

<table border="0" width="288">
<tr>
<td width="80">User Name:</td>
<td width="194"><input type="text" name="userName" size="20"></td>
</tr>
<tr>
<td width="80">Password:</td>
<td width="194"><input type="password" name="passWord1" size="20"></td>
</tr>


<tr>

<td width="288"><input type="button" value="enter" onclick="login()"></td>
<td><input type="reset"></td>
</tr>

</table>
</form>
 
 
Post #: 1
 
 RE: simple form validation help - 4/13/2008 4:59:09 PM   
  ehvbs

 

Posts: 2173
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi need_helpp,

(1) VBScript doesn't support variable substitution/interpolation like Perl or PHP; so

         strUser = "testdomain\" & Document.form1.userName
        strPassword = Document.form1.password1

(2) Consider using the official VBScript string concatenation operator & instead
    of +.

(3) Get rid of the evil global "On Error Resume Next"


Good luck!

ehvbs


(in reply to need_helpp)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> simple form validation help Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts