I do something similar in that I use a stand-alone CFC that holds any error information. Internally, it is stored in an array of structures.
It's pretty simple, but it comes in very handy. I, as well as many others, ran into a similar solution with "typed" CFC instance variables, getters and setters. I had two options: 1. Leave the variables and getters/setters "typed" and then throw/catch errors all over the place or, 2. leave the instance variables "untyped" and use logic in the methods to determine if the value validates. I chose method "2" at the time. M!ke -----Original Message----- From: Steve Brownlee [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 03, 2005 11:09 AM To: CF-Talk Subject: RE: Aggregating Errors There's no way around that if you use the <CFERROR> catch-all page. As soon as CF sees an error, it will pass that specific reference to the error page. You cannot control what information it receives. Why not just have an array in request (e.g. Request.PageErrors) that you add each exception to and then in OnRequestEnd.cfm (or in OnRequestEnd function of Application.cfc) check the length of the array and then display them all? It's really not that hard and doesn't take a lot of code. Instead of <cfthrow ...> you would have this code after every validation check... <cfset arrayAppend(request.pageErrors, "No Service or Product Code entered, one is required.")> Then in OnRequestEnd... <cfif ArrayLen(request.pageErrors) gt 0> <cfloop through your array> ... Display error(s) ... </cfloop> </cfif> > -----Original Message----- > From: Ian Skinner [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 03, 2005 11:22 AM > To: CF-Talk > Subject: Aggregating Errors > > Can anybody give me pointers on a simple method to use cftry/cfcatch > and cferror functionality to aggregate multiple errors into a single > error display? > > This is for a user validation type function. I have several error > blocks such as these. > > <cfif not len(trim(form.service_Code)) AND not > len(trim(form.product_Code))> > <cfthrow errorcode="CPT_001" message="No Service or Product Code > entered, one is required."> </cfif> > > <cfif len(trim(form.service_Code)) AND len(trim(form.product_Code))> > <cfthrow errorcode="CPT_002" message="Both Service and Product Code > entered, only one is allowed."> </cfif> > > This works well, but as soon as any error is triggered, the page is > thrown to the form_exception page defined in the <cferror> tag in the > application.cfm file which displays that one error. > > It has been suggested that a better user expierence would be to find > all errors first and then display them on the exception page. Can I > do this with the above logic, or am I going to have to completely > build a custom error/exception process? > > I thought I could wrap each section in its own try/catch block which > would allow me to agregate all the errors into an array. But then I > could not see a way to throw the entire array to the exception page. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:205418 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

