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

  • Home
  • SEARCH
  • 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 am using this HTML <html> <head> <Title>EBAY Search</title> </head> <script language=JavaScript src=ajaxlib.js></script> <body>
I'm using this script to display all the images in a folder, but I
anyone have any experience using this? if so, is it worth while?
I am using this code to extract a password protected RAR file. I am
I am using this script to read a value in a session, then I
I am using this to compare the password entered and the confirm password. No
I am using this regular expression in a java file to validate the password.
I have a script which can overwrite values in a configuration file using options,
Using this question as the base is there an alogrithm or coding example to
Since I have started using this site, I keep hearing about the Boost library.

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.