Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password Comparision (Easy)

Status
Not open for further replies.

GDX

Programmer
Jun 4, 2000
186
US
I am sure this is a very easy problem for some of you guys. I am new to VBScript so its a little hard for me. I am trying to make a password form that verify that the password i typed in the first textbox is equal to the second text box heres the code i have...


<script language=&quot;VBScript&quot;>
Function VerifyPWD ()
If lcase(RegisterForm.Password.Value) = lcase(RegisterForm.verifypassword.value) then
else
Msgbox (&quot;Please verify that the passwords match&quot;)
exit sub
end if
End Function
</script>

And this is where I call it...

<form name=&quot;registerform&quot; method=&quot;post&quot; action=&quot;register.asp&quot; onSubmit=&quot;Call VerifyPWD()&quot;>

For some reason I keep getting the error &quot;Cannot use parenthesis when calling a sub&quot; any idea?

Thanks! Gordon R. Durgha
gd@vslink.net
 
Just call the sub without the parentheses...

VBScript doesn't like them (unlike JavaScript)

Code:
VerifyPWD

hope it helps!:)
Paul Prewett
 
Hiya
I understand where you're coming from, I wanted to develop something similar for my website. Hope this can help you, you basically had this anyway, you just have to decalre a seperate variable for the second input (password) box.
Try it out!! let me know if it works!
JOE (joewardell@hotmail.com)

<html>
<body>
<Form name=&quot;look&quot; Method=Post>
<Input Type=Text Name=&quot;TxtSearch&quot; size=&quot;14&quot; maxlength=&quot;20&quot;>
<Input Type=Text Name=&quot;TxtSearch2&quot; size=&quot;14&quot; maxlength=&quot;20&quot;>
<Input Type=Button Name=Submit Value=&quot;Go!&quot; onClick=&quot;goSearch()&quot;>
</Form>
<Script Language=VBScript>
Sub GoSearch()
dim searchit, verify
searchit=Document.look.txtsearch.Value
verify =Document.look.txtsearch2.Value
If searchit = verify then
msgbox &quot;well done, these passwords match&quot;
Else
msgbox &quot;sorry, the passwords didn't match&quot;
End If
End Sub
</Script>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top