Link to home
Start Free TrialLog in
Avatar of clonmelog
clonmelog

asked on

Checking password strength error

Hi,

Im using a script that i found at http://www.geekwisdom.com/dyn/passwdmeter to check passwords and how strong they are against the specified rules. Im currently trying to implement it here: http://www.templateit.net/register.php but im getting errors when i try to do it. I cant spot why the error is occuring because it works fine for me on a plain html form and ive just copied over the same code. any ideas?

heres the form code, the js file is available from the above link.

<script type="text/javascript" src="javascript/passwordmeter.js"></script>
<h1 class="HedingText">Register</h1>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td width="124"><div align="left" class="style3">Username*:</div></td><td width="415">
  <div align="left">
    <input type="text" name="uname" maxlength="40"><?=$uname_error?>
  </div></td></tr>
<tr><td><div align="left" class="style3">Password*:</div></td><td>
<input type="password" name="passwd" maxlength="50" onKeyUp="testPassword(document.forms.passwordForm.passwd.value)">
<?=$passwd_error?>Password Strength:
<input name="score" size="3" type="text"> &nbsp; Strength verdict: <input name="verdict" size="15" type="text">
</td></tr>
</form>
Avatar of nschafer
nschafer
Flag of United States of America image

Hi clonmelog,

Your form does not have a name.  Based on your code it should be named "passwordForm"

Also I don't know if I'd use the onKeyUp method for this.  I would think onBlur would be more appropriate, but since I don't know exactly what the function is doing I can't say that for sure.

Hope this helps,
Neal.
Avatar of Zvonko
Change this:

<input type="password" name="passwd" maxlength="50" onKeyUp="testPassword(document.forms.passwordForm.passwd.value)">

To this:

<input type="password" name="passwd" maxlength="50" onKeyUp="testPassword(this.value)">

ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of clonmelog
clonmelog

ASKER

with that code i still get an error on the page@:

http://www.templateit.net/register.php
You did not copy the first character from my upper example.
You have this:
************************************************************ */
unction testPassword(theField){

Silly mistake, sorry.

thanks for the help, that works great.
You are welcome.