Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6182283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:10:24+00:00 2026-05-24T01:10:24+00:00

I am using this for my password matching but it is not working can

  • 0

I am using this for my password matching but it is not working can anyone edit it please

 <html>
<head>

<script type="text/javascript">
function validateFormOnSubmit(theForm) {
var reason = "";

reason += validatePassword(theForm.pw1);

if (reason != "") {
    alert("Some fields need correction:\n" + reason);
    return false;
  }

  alert("All fields are filled correctly");
  return false;
}

function validatePassword(fld) {
    var error = "";
    var illegalChars = /[\W_]/; // allow only letters and numbers 

    if (fld.value == "") {
        fld.style.background = 'Yellow';
        error = "You didn't enter a Password.\n";
    } else if ((fld.value.length < 3) || (fld.value.length > 15)) {
        error = "The Password is the wrong length. \n";
        fld.style.background = 'Yellow';
    } else if (illegalChars.test(fld.value)) {
        error = "The Password contains illegal characters.\n";
        fld.style.background = 'Yellow';
    } else if (!((fld.value.search(/(a-z)+/)) && (fld.value.search(/(0-9)+/)))) {
        error = "The Password must contain at least one numeral.\n";
        fld.style.background = 'Yellow';
    } else {
        fld.style.background = 'White';
    }
   return error;

}  
function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
}
</script>
</head>

<body>
<form onsubmit="return validateFormOnSubmit(this)" >

<table border=0>
  <tr>
    <td><label for="pw1">Password:</label></td>
    <td><input type="password" name="pw1" size="20" id="password" /></td>
  </tr>
  <tr>
    <td><label for="pw2">Confirm Password:</label></td>
    <td><input type="password" name="pw2" size="20" id="confPassword" /></td>
  </tr>
<tr>
<td colspan=2 align=center><input type=submit value="Submit!"></td>
</tr>
</table>
</form>
</body>
</html>

its working but i want to match the password also . but i am unable to do that how can do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:10:25+00:00Added an answer on May 24, 2026 at 1:10 am

    Just add another check and pass the second password box as well: http://jsfiddle.net/n9mL4/1/.

    validatePassword(theForm.pw1, theForm.pw2);
    

    and

    ... } else if(fld.value != fld2.value) {
        error = "Not equal.";
        fld.style.background = "Yellow";
        fld2.style.background = "Yellow";
    } else { ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read from this article http://codahale.com/how-to-safely-store-a-password/ and it says using a salt isn't
Using this: Can I use Facebook's fb:friend-selector in an iframe? I created a multi-friend
Using this code var html='<div class=somediv></div>'; var target=document.getElementById('contentArea'); target.appendChild(html); I'm getting Uncaught Error: NOT_FOUND_ERR:
Using this command GRANT ALL PRIVILEGES ON *.* to 'brian'@'%' identified by 'password'; I
I have just added a null password field to a mysql table using this
i'm testing a password confirmation validation. when im using this code with variables, it
I'm using this js to display default password, when user clicks it automatically clears
I'm using this script for building application from command line: #!/bin/bash TARGET=signtest CONFIGURATION=Debug SDK=iphoneos
I'm using this code to make #sidebar 's height match #post_content 's height: <script
I'm using this to (try) to validate a 'strong' password in ColdFusion 7. if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.