Solved

password fields check using ajax

Posted on 2011-02-16
9
828 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
PowerShell Core for Advanced Linux Administrators

Understand advanced principals around Powershell Core with a focus on the Linux Administrator.  This course covers how to administer numerous environments across multiple platforms including Linux, Azure, AWS, and Google Cloud from a single shell instance.

 
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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

623 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