I could - I was just hoping for a quick(er) fix.

I guess I'm also being a little silly... thinking that CFTRY is only for
"pure" errors, not validation rules...

But I probably should use it... it does make perfect sense.

Jim Davis

> -----Original Message-----
> From: Scott Brady [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 27, 2003 7:53 PM
> To: CF-Talk
> Subject: Re: Smart or Stupid (CFLOOP as a GOTO)
> 
> ----- Original Message -----
> From: "Jim Davis" <[EMAIL PROTECTED]>
> 
> > That's only checked (as far as I understand it) before each iteration,
> not
> > throughout the processing.
> >
> > In other words setting "theform" equal to "invalid" will not stop
> processing
> > immediately - it will finish out the rest of the code in the loop THEN
> stop.
> 
> 
> What about using a cftry/catch block?
> 
> Put a cftry around it (forget the loop entirely).  When you encounter a
> validation issue, cfthrow with your error message. Then, in the cfcatch,
> do
> what you need to do when you want to stop the processing.
> 
> <cftry>
>       <cfif emailIsInvalid>
>             <cfthrow type="myValidation" message="The e-mail address is
> invalid.">
>       </cfif>
>       <cfcatch type="myValidation">
>             <cfoutput>
>                 #cfcatch.message#
>             </cfoutput>
>             <cfabort>
>       </cfcatch>
> </cftry>
> -------------------------------------------
> Scott Brady
> http://www.scottbrady.net
> 
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Host with the leader in ColdFusion hosting. 
Voted #1 ColdFusion host by CF Developers. 
Offering shared and dedicated hosting options. 
www.cfxhosting.com/default.cfm?redirect=10481

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to