No cfabort stops all processing, however if you need to and depending on
what version of ColdFusion you could do

<cfexit method="exittemplate">

However removing the cfelse and cfabort should work too, this is how I would
do it first then go with the above method.


Regards,
Andrew Scott
http://www.andyscott.id.au/



> -----Original Message-----
> From: John Barrett [mailto:[email protected]]
> Sent: Monday, 18 April 2011 3:18 PM
> To: cf-newbie
> Subject: confused about cfabort
> 
> 
> Hi,
> I am confused about <cfabort>. this tag is supposed to stop the
application
> from this point? that is if something goes wrong, the code should not get
> passed this point?
> 
> I have a form, that is a email subscribe list, I want to check the e-mail
twice,
> this code works, but if the user enters the wrong email twice(they match)
I
> want to have the application stop here, and send the user a message to go
> back and fix the problem.
> 
> if there is a better way to check if the emails match and display a
message
> then using <cfabort> please let me know, thanks in advance Johnny
> 
> The first part is just a form, here is the action page:
> <!--- code--->
>  <cfparam name="form.name" default="">
> <cfparam name="form.email" default="">
> <cfparam name="form.email_type" default="0"> <cfparam
> name="form.organization" default=""> <cfparam name="form.activity"
> default="">
> 
>       <cfquery name="DupCheck" datasource="#REQUEST.dataSource#">
>               SELECT *
>               FROM  email_alerts
>               WHERE email_address = <cfqueryparam
> cfsqltype="cf_sql_varchar" value="#Form.email_address#" />
>       </cfquery>
> 
> 
>     <!--- check to see if the user entered the correct e-mail twice --->
> 
>       <cfif compare(form.email_address,form.email_address2) eq 0>
>      The Emails did not match! <br />
> Please go back to the <a href="subscribe.cfm">subscribe form</a> and try
> again.
> 
>     <cfelse>
> 
>        <cfabort>
> <!--- The Application should stop here and have the user go back to the
> form--->
>     </cfif>
> 
> <!--- The Application continues if the emails are both the same--->
> 
> <!--- If our query shows a email match than using recordCount we can tell
the
> user that his email address already exists in our database ---> <cfif
> DupCheck.recordCount GT "0">
>     Your email is already Listed in our Mailing List, <br /> Please go
back to the
> <a href="subscribe.cfm">subscribe form</a> and try again.
>    <!--- If our recordCount is not greater than "0" we continue on and
process
> the new email address --->
> 
>    <cfelse>
> 
> 
> 
>        <!--- Insert the new record --->
>               <cfquery name="AddUser"
> datasource="#REQUEST.dataSource#">
>                  INSERT INTO email_alerts (name, email_address,
> email_type, organization,activity, date)
>                 VALUES ('#form.name#',
> '#form.email_address#','#form.email_type#','#form.organization#','#form.a
> ctivity#',#CreateODBCDateTime(Now())#)
>               </cfquery>
> 
>                                                 <cfoutput>
>        Thank you #Name#,<br />
>        Your email address [#email_address#] Has been entered into our
mailing
> list. You'll receive the next mailing!
>      </cfoutput>
> 
> </cfif>
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~|
> Order the Adobe Coldfusion Anthology now!
> http://www.amazon.com/Adobe-Coldfusion-
> Anthology/dp/1430272155/?tag=houseoffusion
> Archive: http://www.houseoffusion.com/groups/cf-
> newbie/message.cfm/messageid:5269
> Subscription: http://www.houseoffusion.com/groups/cf-
> newbie/subscribe.cfm
> Unsubscribe: http://www.houseoffusion.com/groups/cf-
> newbie/unsubscribe.cfm


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5270
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm

Reply via email to