I often first create a variable and apply all processing to it before
passing it into the tag, e.g.

        <cfif isdefined("session.Form.CCEmail")>
                <cfset MyCC = "#session.Form.CCEmail#">
        <else>
                <cfset MyCC = "">
        </cfif>


         <cfmail to="[EMAIL PROTECTED]"
           from="[EMAIL PROTECTED]"
                 subject="Order Information"
                 cc="#MyCC#"
           type="HTML">

It's a bit longwinded, but it works.






> -----Original Message-----
> From: Raymond B. [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 17, 2001 9:05 AM
> To: CF-Talk
> Subject: RE: Imbedding IF statements into a tag.......
>
>
> Inline IF? IIF() :)
>
> IIF(expression, true_expr, false_expr)
>
> Check the lang. ref. for more detail.
>
> -----Original Message-----
> From: Stevens, Jason [mailto:[EMAIL PROTECTED]]
> Sent: May 16, 2001 23:42
> To: CF-Talk
> Subject: Imbedding IF statements into a tag.......
>
>
> Is it possible to imbed IF statements into a tag? For example,
> you have the
> following statement:
>
> <cfmail to="[EMAIL PROTECTED]"
>         from="[EMAIL PROTECTED]"
>         subject="Order Information"
>         cc="#session.Form.CCEmail#"
>         type="HTML">
>
> Of course, when the session variable session.Form.CCEmail doesn't
> exist, it
> error's off. Would there be a way to imbed an if statement that would only
> add the cc section of the cfmail tag if the variable exists
> without writing
> is as:
>       <cfif isdefined("session.Form.CCEmail")>
>               cfmail with cc section
>       <else>
>               cfmail without the cc section
>       </cfif>
> I would rather do it inline of the tag if possible. Even if it just leave
> the variable at a zero value, so long as the variable is set and it won't
> error off.
>
> Thanks in advance, (sorry for the newbie question :)
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to