Ajas, I tried your code and things worked as expected on both FF and Chrome on CF 7 and 8, but on IE (7), the regex would not work even if a correct value was entered the first time, so this is not about "that once the alert is displayed, even if the user corrects the error and enters a strong password, the error alert does not go away." It just doesn't work at all.
I'm no regex expert, but I can at least confirm that when I entered 123456uU, it worked, when I left off the trailing U, it failed (and in FF and Chrome, correcting that did then pass). I saw the later note from Teddy proposing some known bug with lookahead in regex. Again, I leave that for you or others to explore, but I wanted to put out at least this observation about how you were seeing the error, and also how it's limited to IE. Along the same lines, I'll suggest that with any such attempt to get something working, it's best to have a simplified example that does just want you're interested in. It not only helps you focus your challenge (and sometimes helps show that a problem is something other than what you thought, though not in this case), but it also helps others to more quickly validate something you're having a problem with. I used this code: <cfform preservedata="Yes"> <cfinput type="password" name="new_password" validate="regular_expression" pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}$" validateat="onBlur,onSubmit,onServer" message="Your password is not strong. Your password should be atleast 8 characters long, consiting of one Upper case and one Lower case and one Number." > <input type="Submit"> </cfform> <cfif request_method is "post"> Password: <cfoutput>#form.new_password#</cfoutput> </cfif> The preservedata (one of the little hidden gems with CFFORM added in CF 7) will keep the value entered from one submission to the next, FWIW. /charlie From: ad...@acfug.org [mailto:ad...@acfug.org] On Behalf Of Ajas Mohammed Sent: Monday, March 09, 2009 11:28 AM To: discussion@acfug.org Subject: [ACFUG Discuss] Password CFinput regular expression - throws alert/error after correction also Hi there, I have this code which checks if password is strong i.e. atleast 8 characters long, consiting of one Upper case and one Lower case and one Number.and if not alerts the user about it. I am using a regular expression to do this as u can see from code below. The problem is that once the alert is displayed, even if the user corrects the error and enters a strong password, the error alert does not go away. For example, if i entered password for the first time, then obviously I will get alert saying password is not strong. Then, afterwards if i correct password to be lets say Leave1234 which is 9 chars, has one uppper case, one lower case and has a number also, I still end up getting password not strong message. I tried removing onBlur,OnSubmit one at a time but doesnt work. Any ideas???? Here is the code New Password: <!--- some possible regular expressions i used new_password ---> <!--- ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}$ or ---> <cfinput type="password" name="new_password" validate="regular_expression" pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}$" validateat="onBlur,onSubmit,onServer" message="Your password is not strong. Your password should be atleast 8 characters long, consiting of one Upper case and one Lower case and one Number." > <Ajas Mohammed /> http://ajashadi.blogspot.com We cannot become what we need to be, remaining what we are. No matter what, find a way. Because thats what winners do. You can't improve what you don't measure. Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives. ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -------------------------------------------------------------