• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfif

New Here ,
Jan 05, 2007 Jan 05, 2007

Copy link to clipboard

Copied

Hi i have the following cfif,

<cfif IsDefined("form.EXH_Program_#currRow#")>

i need to change it to
<cfif ("form.EXH_Program_#currRow#") EQ "X">

but this is not working any ideas why?
TOPICS
Advanced techniques

Views

284

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 05, 2007 Jan 05, 2007

Copy link to clipboard

Copied

> <cfif ("form.EXH_Program_#currRow#") EQ "X">
>
> but this is not working any ideas why?

Well the string "form.EXH_Program_#currRow#" (which is what it is: just a
string) will never equal "x" will it?

You probably mean:
form["EXH_Program_#currRow#"] eq "x"

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 05, 2007 Jan 05, 2007

Copy link to clipboard

Copied

Also, if you need to do the same thing for variables not in a collection (i.e. the form collection in this case), you can always use the Evaluate() function:

e.g.
Evaluate("form.EXH_Program_#currRow#")
or
Evaluate("form.EXH_Program_" & currRow)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 05, 2007 Jan 05, 2007

Copy link to clipboard

Copied

quote:

Originally posted by: insuractive
Also, if you need to do the same thing for variables not in a collection (i.e. the form collection in this case), you can always use the Evaluate() function:
e.g.
Evaluate("form.EXH_Program_#currRow#")
or
Evaluate("form.EXH_Program_" & currRow)

True, but, using array notation as per Adam's post is more efficient.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 05, 2007 Jan 05, 2007

Copy link to clipboard

Copied

LATEST
Also, using array notation is not a massive security whole as evaluating data that is provided by users is basically madness. In addition virtually every ariable in CF is in a structure(collection) so you never need to use evaluate(), if you are using it then you are doing something wrong, the only time I can think you couldn't avoid using it is to use dynamic method names.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation