Classic ASP DatabasesDiscuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
I am trying to validate my input but it's not working though the program does not give any error. I have two versions of the code and none is working. Please help me out.
1st version:
<% Response.Buffer = False %>
<html>
<head>
<SCRIPT language="JavaScript">
<!--
function VerifyData()
{
if (document.frmUser.NewPassword.lenght == 0)
{
alert ("You must enter a password");
return false;
}
else
return true;
}
-->
</SCRIPT>
<Title>Passoword change website</title>
</head>
<body>
<h2>Try changing your password</h2>
<form method="post" action="start2202.asp" NAME="frmUser" onSubmit="return VerifyData()">
<p>Please enter your student id:</p>
<p><INPUT type="text" name="StudentId" size="10"></p>
<p>Please enter your student old password:</p>
<p><INPUT type="password" name="Password"></p>
<p>Please enter your newpassword:</p>
<p><INPUT type="password" name="NewPassword"></p>
<p>Please verify your new password:</p>
<p><INPUT type="password" name="VerifyPassword"></p>
<Title>Passoword change website</title>
</head>
<body>
<h2>Try changing your password</h2>
<form method=post action=start2202java.asp NAME=frmUser>
<p>Please enter your student id:</p>
<p><INPUT type="text" name="StudentId" size="10"></p>
<p>Please enter your student old password:</p>
<p><INPUT type="password" name="Password"></p>
<p>Please enter your newpassword:</p>
<p><INPUT type="password" name="NewPassword"></p>
<p>Please verify your new password:</p>
<p><INPUT type="password" name="VerifyPassword"></p>
<script language=vbscript>
Sub btnSubmit_OnClick()
If Len(frmUser.NewPassword.value) = 0 Then
Alert "You must enter a club name"
frmUser.NewPassword.focus
Exit Sub
ElseIf Len(frmUser.VerifyPassword.value) = 0 Then
Alert " You must verify your password"
frmUser.VerifyPassword.focus
Exit Sub
End If
You misspelled length in your first example.... I'm not sure if that was a typo or direct copy-paste. I don't know VBScript, so I can't judge your second example.
1. Where do invoke your SUBMIT button OnClick Event? In your case you have just defined a function that needs to be called on click event.
2. Call frmUser.submit() ??? you may need to remove this.
3. I am not sure how you are processing it in your start2202java.asp
Additionally you may need to check if the NEW PASSWORD matches with VERIFYPASSWORD, which I do not see in your code.