Solved

password fields check using ajax

Posted on 2011-02-16
9
823 Views
Last Modified: 2012-05-11
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

https://scgi.ebay.co.uk/ws/eBayISAPI.dll?RegisterEnterInfo
0
Comment
  • 5
  • 4
9 Comments
 
LVL 39

Expert Comment

by:gdemaria
ID: 34916102
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.
 
0
 
LVL 16

Author Comment

by:Gurpreet Singh Randhawa
ID: 34918537
i am also loking if the password is at least 5 characters how that can be implemented
0
 
LVL 16

Author Comment

by:Gurpreet Singh Randhawa
ID: 34918610
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
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 39

Accepted Solution

by:
gdemaria earned 100 total points
ID: 34918703
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';"
0
 
LVL 16

Author Comment

by:Gurpreet Singh Randhawa
ID: 34918785
and how do i apply a check to chec a minimum of 5 characters
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 34918899
Sounds like that should be part of the check in your first password along with testing the strength in the little pop-up div.
0
 
LVL 16

Author Comment

by:Gurpreet Singh Randhawa
ID: 34918947
yes, sorry forget to append that

:)
0
 
LVL 16

Author Comment

by:Gurpreet Singh Randhawa
ID: 34923554
just do let me know the check for the password length of minimum of 5 fields also

Thanks

a Big thanks for helping out, I am learning from such great experts
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 34925968
> 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...
</cfif>
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question