Wrox Programmer Forums
|
Classic ASP Databases Discuss 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
 
Old April 8th, 2004, 04:10 PM
Authorized User
 
Join Date: Feb 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help

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>

<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>
</body>
</html>


2nd version:

<% Response.Buffer = False %>
<html>
<head>

<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>

<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

<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

    Call frmUser.submit()
End Sub

</script>
</body>
</html>


 
Old April 8th, 2004, 04:32 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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.

Snib

P2P Member
<><
 
Old April 8th, 2004, 09:14 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

In your second version.

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.


-Vijay G









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.