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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input validation - password confirmation

Status
Not open for further replies.

richardhowell

Instructor
Oct 31, 2002
75
0
0
GB
== Environment: Ultradev 4, Java ==
I'm having a pretty frustrating time trying to do (what should be) some simple validation on an input form for registration. I just want to compare the password entry with the "Confirm Password" entry for equality. If not equal, redirect to a page telling them to go back and try again.
The closest I've got is with the following statement which compares the string(request.form) values

if(String(Request.Form("fldpw1") !== String(Request.Form("fldpw2")) ))
{
Response.Redirect('pw_err.asp');
}

...... but this directs me to pw_err page UNCONDITIONALLY.
I'm new to Java by the way!
Anybody help? Hope so.
Richard
P.S. Please don't direct me to Yaromat's Check Form. That simply doesn't work!

 
Hi Rich,

I hate to do what you asked us not to do. BUT

I use yaromat (as seen in my earlier post) and it works fine for password field comparisons. However im using asp. Perhaps there is an issue with how you are setting up the check form that could be at fault. If not, ignore this completely and think of it as my little thank you note to lebisol (from here) and yaromat (extension god) for helping me. Keep in mind, there are two versions (UD4 and DMX) as well as recent updates, perhaps that could be the problem you are having. Otherwise, good luck with the java.
 
Thanks for that Mother. Well after a lot of sweat and tears I've cobbled together some java which seems to work. However, I'm willing to give old yaromat another try, if you can guide me. You mention 2 versions UD4 and DMX. Don't know which I've got, except it's V4.6, downloaded a few days ago. What's the diff between these versions and how do I find out which I've got? Also, you mentioned there may be an issue in the way I'm setting it up. Any pointers here? From what I remember, I just installed it and it appeared on my behaviors list.
R.
 
if this is the only thing u need...then use some small JS:
=================copy/paste================
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<script language=&quot;javascript&quot;>
<!--
function confirmPass() {
if (document.form_name.tfPassword != document.form_name.tfPassConfirm)
{
alert (' > Passwords did NOT match and are case sensitive! Please Re-Enter!')
return false;
}
}
//-->
</script>

<body>
<form name=&quot;form_name&quot; method=&quot;post&quot; action=&quot;&quot; onSubmit=&quot;confirmPass();&quot;>
<p>
<input name=&quot;tfPassword&quot; type=&quot;password&quot; id=&quot;tfPassword&quot;>
</p>
<p>
<input name=&quot;tfPassConfirm&quot; type=&quot;password&quot; id=&quot;tfPassConfirm&quot;>
</p>
<p>
<input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot;>
<input name=&quot;Reset&quot; type=&quot;reset&quot; id=&quot;Reset&quot; value=&quot;Reset&quot;>
</p>
</form>
</body>
</html>
====================================end==


All the best!

> need more info?
:: don't click HERE ::
 
sorry for the post above...I wish that there is a way to delete.edit posts....that was an aold snip that I edited without any coffe in me :)
here:----------------------
<html>
<head>
<title>Password Test</title>
</head>
<script language=&quot;javascript&quot;>
<!--
function PassME()
{
if (document.myForm.PWD1.value != document.myForm.PWD2.value)
{
alert(&quot;Passwords do not match!&quot;);
}
else
document.myForm.submit();
}
//-->
</script>
<body>
<form method=&quot;POST&quot; name=&quot;myForm&quot;>
<table border=&quot;0&quot;>
<tr>
<td>Password</td>
<td><input type=&quot;password&quot; name=&quot;PWD1&quot; size=&quot;20&quot;></td>
</tr>
<tr>
<td>Repeat Password</td>
<td><input type=&quot;password&quot; name=&quot;PWD2&quot; size=&quot;20&quot;></td>
</tr>
<tr>
<td colspan=&quot;2&quot; align=&quot;center&quot;> <input type=&quot;button&quot; value=&quot;Submit&quot; onClick=&quot;PassME();&quot;>
<input type=&quot;reset&quot; value=&quot;Reset&quot;> </td>
</tr>
</table>
</form>
</body>
</html>
-------------------------------

I know some migh argue that there are better ways ( onSubmit) but the truth is...if user wants to submit anything then they have to click submit :) right!
Also I would look into Yaromat.com since he has a roboust JS that will do A LOT more valifdation than this little JS.
Anyhow,
all the best!

> need more info?
:: don't click HERE ::
 
Lebisol - your input is much appreciated. I'll try this when I have time. At the moment I'm going with what I've got as I'm working to a tight schedule.
Thanks
R.
 
Hey Rich..


Sorry been a little hectic here, and forgot to come back and check on your reply.

UD4 requires this version of yaromat's check form
it was last updated in July on the 16th.

By setup, I simply meant that both fields must be checked as mandatory, and one selected as anything, and the other selected as must match field X in which you choose the field it must match.

Wish I would have gotten back sooner,
Mother
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top