Dynamically variable assignment

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Dynamically variable assignment

    The following code does not work.


    <CFPARAM Name="FieldList" Default="FirstName,LastName,CGId,EmpId">

    <CFIF IsDefined("Form.NewSearch") AND Form.NewSearch>
    <CFLOOP LIST="#FieldList#" INDEX="CurrentItem">
    <CFSET Evaluate("Form." & CurrentItem) = "">
    </CFLOOP>
    </CFIF>

    Is it possible to assign a variable - variableName a value?

    kruse Guest

  2. Similar Questions and Discussions

    1. #39496 [NEW]: $_SESSION assignment to variable stops register data
      From: bartek at cpu-zeto dot com dot pl Operating system: Windows XP PHP version: 5.2.0 PHP Bug Type: Session related Bug...
    2. Can Flash display a CF variable value dynamically?
      Title pretty much sums it up. Want my flash movie to include text pulled from a CFQUERY. I know there is a "dynamic text" option in the property...
    3. Left side of assignment operator must be variable or property
      Below got error: for (i in _parent.arrQues){ "text"+i = _parent.arrQues; } How can I correct it? Tks for help!
    4. Variable assignment question
      In the programming language I use at work, we're able to do the following type of variable assignment: A = B = C = 10.0 I haven't found any...
    5. dynamically substituting variable name
      hi, I want to dynamically substitute a variables name. I know this from PHP where you can have somthing like ${$foo} how can I do this in...
  3. #2

    Default Re: Dynamically variable assignment

    Try



    <CFPARAM Name="FieldList" Default="FirstName,LastName,CGId,EmpId">

    <!--- assumes form.NewSearch is a true / false value?? --->
    <CFIF IsDefined("Form.NewSearch") AND Form.NewSearch>
    <CFLOOP LIST="#FieldList#" INDEX="CurrentItem">
    <CFSET Form[CurrentItem] = "">
    </CFLOOP>
    <cfdump var="#form#">
    </CFIF>

    mxstu Guest

  4. #3

    Default Re: Dynamically variable assignment

    Great it works,
    Thanks
    kruse Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139