Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

password fields check using ajax

Posted on 2011-02-16
9
Medium Priority
?
833 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 39

Accepted Solution

by:
gdemaria earned 400 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

705 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