Why not just use JavaScript client side and then use CF server side?


-----Original Message-----
From: Jim Davis [mailto:[EMAIL PROTECTED]
Sent: Friday, June 27, 2003 8:03 PM
To: CF-Talk
Subject: RE: Smart or Stupid (CFLOOP as a GOTO)


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

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

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

Reply via email to