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.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:205396
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to