Don't do the CFIFs inside the CFLOCATION - instead, build up a text string
using your CFIFs, then use that string in the CFLOCATION for your URL.
Nesting tags within other tags = boo-boo.
----- Original Message -----
From: "Stephenie" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, February 01, 2001 10:08 AM
Subject: OT: cfif statements in a cflocation tag=icky url
> i have a form which takes a few input fields, then passes them to a 2nd
> template for evaluation, a url is built that needs to include the
variables
> from the form if they exist, which is then sent via cflocation to a 3rd
> template for the appropriate action.
>
> on the 2nd template, i am using cflocation with a few cfif statements
inside
> it to determine if the form fields were present and build the url
> accordingly, if i enter a line break before the cfif, cf does not pass the
> values in the url, the only way it seems to want to work is if i run the
> whole thing together,
>
> cf includes the passed variables in the url, but the url looks terrible as
> it includes the cfif code....
>
> please tell me i am missing something obvious or there is a cleaner way to
> do this.
>
> -------cf code---------------
> <cflocation
>
url="http://#attributes.serverip#/mydir/mytemplate.cfm?username=#attributes.
> username#<cfif
> #isDefined("attributes.dsn1")#>&dsn1=#attributes.dsn1#<cfelseif
> #isDefined("attributes.dsn2")#>&dsn2=#attributes.dsn2#<cfelseif
> #isDefined("attributes.dsn3")#>&dsn3=#attributes.dsn3#</cfif>">
> -------------------------------
>
> ------------url produced from above code-------------------
>
http://serverip/mydir/mytemplate.cfm?username=user23<cfif%20YES>&dsn1=blah1<
> cfelseif%20YES>&dsn2=blah2<cfelseif%20YES>&dsn3=blah3</cfif>
> -----------------------------------------------------------
> (serverip was edited for this post)
>
> --
> Stephenie Hamilton
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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