password fields check using ajax

i am trying to check the values in password and confirm password fields!

currently it is working fine!

the problem is as soon as i type in password and focus to the confirm field, it shows me the message, while i want that after entering the password field and then after the confirm password field when it should leave focus from the confirm password then it should match and show that there is error!

my current code is nt doing like this

<cfdiv bindOnLoad="False" bind="url:checkpassword.cfm?password_buyer={password}&confirm={re_password}&sting=4" ID="theDiv_pass1" style="color:red;"/><div id="theDiv_pass1"></div>

please guide

i want same functionality as of
LVL 16
Gurpreet Singh RandhawaWeb DeveloperAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

gdemariaConnect With a Mentor Commented:
if you are changing the confirm password (the 2nd field) to the correct value the javascript if statement will either hide or show the warning DIV.  

onChange="if (documnet.getElementById('p1').value != this.value) {document.getElementById('warn').style.display='block';} else {document.getElementById('warn').style.display='none';}

You can add this to the first password field...   it will hide the warning and clear the 2nd field for entry

 onChange="documnet.getElementById('p2').value =''; document.getElementById('warn').style.display='none';"
there seem to be two things going on in that eBay code, the first verifies the quality of your password, the second compares the two entries and show the red text if they are not the same.   It sounds like you are trying to accomplish this second one.

This seems like simple javascript that should be on the second field.

The javascript would be something like this...

<input id="p1" name="pswd">
<input id="p2" name="confirmPswd" onChange="if (documnet.getElementById('p1').value != this.value) {document.getElementById('warn').style.display='block';} else {document.getElementById('warn').style.display='none';}>

<div id="warn" style="display:none;">Passwords don't match</div>

If you want to do that pop-up bubble with the tips, then you could use the ajax stuff only on the first field.
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
i am also loking if the password is at least 5 characters how that can be implemented
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
also if i enter the password as 4567 as first and then abcfedg in confirm box, it shows fine, then i correct the second passowrd to be exact as above, then it shouldd hide that message but it does not
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
and how do i apply a check to chec a minimum of 5 characters
Sounds like that should be part of the check in your first password along with testing the strength in the little pop-up div.
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
yes, sorry forget to append that

Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
just do let me know the check for the password length of minimum of 5 fields also


a Big thanks for helping out, I am learning from such great experts
> just do let me know the check for the password length of minimum of 5 fields also

I thought this was all set - you were going to add it to the CF ajax part where you popup that window?

Since that is on the Server side you can use coldfusion with a simple check..

 <cfif len(url.password) gt 0 and len(url.password) lte 5>
    Not Long Enough...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.