Again, many thanks Qasim. And while I'm at it, thanks Doug (and contributors) for providing us with such an excellent product, I'm loving it so far. -TM
_____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Qasim Rasheed Sent: Wednesday, March 07, 2007 2:05 PM To: [email protected] Subject: Re: [Reactor for CF] RE: Validation help I believe there is a method in record object called validated that you can use <cfif this.user.validated() and this.user.HasErrors()> HTH On 3/6/07, Thomas Messier <[EMAIL PROTECTED]> wrote: Thanks Qasim, I think I got the hang of it. I guess what I was doing before, which was overriding the validate method of the record object worked pretty well, but putting it in the validator seems more logical since that's the purpose. It's also nicer when outputing errors because all the email errors are grouped, whereas the other way my custom email error appeared last, which makes sense. One other question, I noticed that a record's hasError message fails if you call it without having done validation first. That's because it tries to run _getErrorCollection().count(), but since _getErrorCollection() doesn't return a collection until you've validated (it defaults to 0 as far as I can tell), you get an error. It seems to me it would be nice if the hasError() returned false if validation hasn't been performed, assuming you'd have an empty ErrorCollection as opposed to 0. But in the meantime, I'm left with doing as follows: <cfif IsObject(this.user._getErrorCollection()) AND this.user.hasErrors()> // output validation errors here </cfif> This doesn't seem like the cleanest way to go about it, but that's what I came up with. Anything better to handle this? Thanks again. _____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Qasim Rasheed Sent: Tuesday, March 06, 2007 8:33 PM To: [email protected] Subject: Re: [Reactor for CF] RE: Validation help Tom, What we usually do is to write our custom validation routines in OurRecordValidator.cfc and if any errors are caught e.g. passwords do not match, we do something like this function name="validateConfirmPassword" if record.getNewPassword() neq record.getConfirmPassword set arguments.errorCollection.addError( 'UserRecord.PASSWORD.DONOTMATCH' ) end if The error UserRecord.Password.PasswordDoNotMatch can be defined in userRecord.xml under dictionary folder. Thanks On 3/5/07, Thomas Messier < <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]> wrote: Well I'll be damned, I think I figured this one out! I guess after running the validate method some new folders got created, and now I'm getting a hang of it. But I guess I could still clear some doubts. I'm adding my validation inside my Record object, but there's also a Validator object that can be customized. Should I really be overriding the validate method in the Record object, which is what I saw in some tutorials, or is there something new with the Validator cfc's that I should know of? -TM -----Original Message----- From: Thomas Messier [mailto:[EMAIL PROTECTED] Sent: Monday, March 05, 2007 7:55 PM To: ' <mailto:[email protected]> [email protected]' Subject: Validation help I've been trying to figure out how to use the validation but the more I look online the more I get confused. I've found some tutorials/examples, but they all seem to refer to things that I can't find in my installation. I'm not really sure where dictionary files are supposed to go since I don't find any for my record cfcs. I also see references to rvdata folders with Validator components that I can't seem to find. Can somebody just point me in the right direction, I ought to be able to figure things out if I can get the basics down. Thanks. -TM -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ <http://www.mail-archive.com/reactor%40doughughes.net/> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Qasim Rasheed Certified Advance ColdFusion MX Developer (IM qasimrasheed AT yahoo, msn or GTalk) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ <http://www.mail-archive.com/reactor%40doughughes.net/> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Qasim Rasheed Certified Advance ColdFusion MX Developer (IM qasimrasheed AT yahoo, msn or GTalk) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
