needs to be
<cfif>
<cfform></cfform>
<cfelse>
<cfform></cfform>
</cfif>
but you could do:
<cfif IsDefined ('URL.myvariable')>
<cfset Q="?myvariable=true">
<cfelse>
<cfset q="">
</cfif>
<cfform action="emp_add_action.cfm#q#" >
</cfform>
From: "Gregory Harris" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: <[EMAIL PROTECTED]>
Subject: Re: CFIF and CFELSE
Date: Thu, 13 Jul 2000 10:14:38 -0700
I remember having a problem like that, I believe that ColdFusion interperts
tag nesting before evaluating CFIF and other statements within code. Which
means your code must start and end evenly. It may seem redundant but
putting the entire form within each of the CFIF brackets I believe is the
only way out of this one.
Gregory Harris
Los Angeles ITA Dept.
[EMAIL PROTECTED]
>>> [EMAIL PROTECTED] 07/13 8:39 AM >>>
This is a MIME message. If you are reading this text, you may want to
consider changing to a mail reader or gateway that understands how to
properly handle MIME multipart messages.
--=_2C7475F2.A6C7A9E6
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
There Must be something I don't know about CFIF. I want to check if a URL =
variable exists. If it does, I want to add the same variable to the URL =
of the action of a CFForm, basically so I can check for it on the action =
page, and use it to re-route a cflocation. =20
Here's the problem. I have a CFIF that, if it's true, starts a CFFORM =
with the URL variable included in the action, then it has a CFELSE that =
starts the same form, just without the URL variable. Problem is, it =
doesn't work. Tells me that there's an extraneous </CFFORM> at the bottom =
of the template. Basically, whether or not the criterion is met, it =
doesn't start the form. =20
I musta missed something about CFIF, CFELSE, or CFFORM. Any Ideas? =
Here's my logic:
<cfif IsDefined ('URL.myvariable')>
<cfform action=3D"emp_add_action.cfm?myvariable=3Dtrue" method=3D"post"
=
enablecab=3D"Yes">
<cfelse>
<cfform action=3D"emp_add_action.cfm" method=3D"POST"
enablecab=3D"Yes">=
</cfif>
Whether myvariable exists or not it doesn't print either of the cfform =
lines.
--=_2C7475F2.A6C7A9E6
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Description: HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" http-equiv=3DContent-Type=
>
<META content=3D"MSHTML 5.00.3013.2600" name=3DGENERATOR></HEAD>
<BODY bgColor=3D#ffffff=20
style=3D"FONT: 10pt Arial; MARGIN-LEFT: 2px; MARGIN-TOP: 2px">
<DIV>There Must be something I don't know about CFIF. I =
want=20
to check if a URL variable exists. If it does, I want to add =
the same=20
variable to the URL of the action of a CFForm, basically so I can check =
for it=20
on the action page, and use it to re-route a cflocation. </DIV>
<DIV> </DIV>
<DIV>Here's the problem. I have a CFIF that, if it's true, starts a =
CFFORM=20
with the URL variable included in the action, then it has a CFELSE that =
starts=20
the same form, just without the URL variable. Problem is, it =
doesn't=20
work. Tells me that there's an extraneous </CFFORM> at the =
bottom of=20
the template. Basically, whether or not the criterion is met, it =
doesn't=20
start the form. </DIV>
<DIV> </DIV>
<DIV>I musta missed something about CFIF, CFELSE, or CFFORM. Any=20
Ideas? Here's my logic:</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><cfif IsDefined ('URL.myvariable')><BR> <cff=
orm=20
action=3D"emp_add_action.cfm?myvariable=3Dtrue" method=3D"post"=20
enablecab=3D"Yes"><BR> <cfelse><BR> &l=
t;cfform=20
action=3D"emp_add_action.cfm" method=3D"POST"=20
enablecab=3D"Yes"><BR> </cfif></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Whether myvariable exists or not it doesn't print either of the =
cfform=20
lines.</DIV></BODY></HTML>
--=_2C7475F2.A6C7A9E6--
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.