4 Replies Latest reply on Jan 5, 2007 7:04 AM by Stressed_Simon

    cfif

    RyanG24
      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?
        • 1. Re: cfif
          Level 7
          > <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
          • 2. Re: cfif
            insuractive Level 3
            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)
            • 3. Re: cfif
              Dan Bracuk Level 5
              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.
              • 4. Re: cfif
                Stressed_Simon Level 1
                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.