Solved

password fields check using ajax

Posted on 2011-02-16
9
819 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
Question by:myselfrandhawa
  • 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 15

Author Comment

by:myselfrandhawa
ID: 34918537
i am also loking if the password is at least 5 characters how that can be implemented
0
 
LVL 15

Author Comment

by:myselfrandhawa
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
 
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 15

Author Comment

by:myselfrandhawa
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 15

Author Comment

by:myselfrandhawa
ID: 34918947
yes, sorry forget to append that

:)
0
 
LVL 15

Author Comment

by:myselfrandhawa
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ajax/jquery setTimeout function 2 35
asp.net repeater js datatable 6 74
AJAX POST or GET 2 37
Single record delete with php/ajax 20 43
PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now