You could pre-assemble the url you wish to pass ahead of time, and
conditionally append the variables to the end of the url string as needed,
or if you'd prefer to do your conditional statements inside the cflocation,
use IIf instead of <cfif>.
--
Jamie Keane
Programmer
SolutionMasters, Inc.
9111 Monroe Rd., Suite 100
Charlotte, NC 28270
www.solutionmasters.com
704.849.7771 x 228 Voice
704.849.9291 Fax
-----Original Message-----
From: Stephenie <[EMAIL PROTECTED]>
To: CF-Talk <[EMAIL PROTECTED]>
Date: Thursday, February 01, 2001 1:17 PM
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