House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Evaluate and cfif

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Chad Gray
04/29/2003 06:04 PM

I still have not mastered the power of evaluate() I am creating a dynamic form for uploading multiple files.  What I want to happen is IF the user did not select a file to upload in one of the Form Fields to no use CFFILE.  So I tried this and it is still hitting CFFILE.  I assume I am using evaluate wrong.... <cfloop list="#FORM.Fieldnames#" index="i"> <cfif evaluate(#i#) NEQ "">   <CFFILE DESTINATION="#qxdfolder#\#session.ProjectName#\PDFs"   ACTION="UPLOAD"   NAMECONFLICT="MAKEUNIQUE"   FILEFIELD="#i#"> </cfif> </cfloop>

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Raymond Camden
04/29/2003 06:16 PM

> I still have not mastered the power of evaluate() Trust me - this is a skill you can probably skip... ----- Excess quoted text cut - see Original Post for more ----- Make sure i is a field you care about. Maybe you have a form field that _isnt_ one of the file fields? Also, instead of evaluate(#i#), use: <cfif form[i] neq ""> or even better <cfif len(trim(form[i]))> ======================================================================== === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc (www.mindseye.com) Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) Email    : jedimaster@mindseye.com Blog     : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus "My ally is the Force, and a powerful ally it is." - Yoda

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Chad Gray
04/29/2003 06:36 PM

Woah.. that was pretty cool.  What is the [i]? ----- Excess quoted text cut - see Original Post for more ----- that ----- Excess quoted text cut - see Original Post for more ----- ======================================================================== > === > Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc > (www.mindseye.com) > Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Raymond Camden
04/29/2003 10:19 PM

In your code, i was the field name, i.e., if i = "foo", then form[i] means form.foo. ======================================================================== === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc (www.mindseye.com) Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) Email    : jedimaster@mindseye.com Blog     : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus "My ally is the Force, and a powerful ally it is." - Yoda ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Chad Gray
04/30/2003 09:40 AM

I meant the brackets.  I have never used brackets in CF except for with an array. Is this a new MX thing? > In your code, i was the field name, i.e., if i = "foo", then form[i] > means form.foo. > > ======================================================================== > === > Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc > (www.mindseye.com) > Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) ----- Excess quoted text cut - see Original Post for more ----- I ----- Excess quoted text cut - see Original Post for more ----- DESTINATION="#qxdfolder#\#session.ProjectName#\PDFs" ----- Excess quoted text cut - see Original Post for more ----- use: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Raymond Camden
04/30/2003 09:46 AM

Oh no - you also use brackets with structures - which I think came to CF in version 4 - or 4.01. If you don't know what a structure is, just consider it an array that uses strings, or names, instead of numbers to represent the things contained within itself. <cfset person = structNew()> You can use either . (dot) or bracket notation to read/set keys: <cfset person.name = "Jacob Camden"> <cfset person["age"] = 3> However, if the structure key isn't itself a valid variable name type string, you must use brackets: <!--- This wont work ---> <cfset person.best friend = "John"> <!--- This will work ---> <cfset person["best friend"] = "John"> ======================================================================== === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc (www.mindseye.com) Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) Email    : jedimaster@mindseye.com Blog     : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus "My ally is the Force, and a powerful ally it is." - Yoda ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Chad Gray
04/30/2003 09:58 AM

Thanks Raymond!  I will read up on structures and how to use them. > Oh no - you also use brackets with structures - which I think came to CF > in version 4 - or 4.01. If you don't know what a structure is, just > consider it an array that uses strings, or names, instead of numbers to ----- Excess quoted text cut - see Original Post for more ----- ======================================================================== > === > Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc > (www.mindseye.com) > Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) ----- Excess quoted text cut - see Original Post for more ----- wrong.... ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Raymond Camden
04/30/2003 10:04 AM

This is my little toturial on when to use them in comparison to arrays. Basically, arrays are useful for storing a collection of data where the index, or the position of the data, doesn't imply anything. So.... arr[1] = "foo" arr[2] = "goo" The fact that "foo" is at position 1 means nothing. At most, it implies it's the first record. Now, consider a case where you want to store information about a person... arr[1] = "ray" arr[2] = "camden" arr[3] = 30 In the above code, I used position 1 for my first name, position 2 for my last name, and so on. While this _works_, it can be a bit confusing. If you realize that you needed a middle name and decide to put it at position 2, then your code that reads any other position at 2 or above will now be broken. Using structures makes this problem go away... person.fname = "ray" person.lname = "camden" person.age = 30 I'm probably being too simple here - but just thought I'd share. ;) ======================================================================== === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc (www.mindseye.com) Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) Email    : jedimaster@mindseye.com Blog     : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus "My ally is the Force, and a powerful ally it is." - Yoda ----- Excess quoted text cut - see Original Post for more -----

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Douglas.Knudsen
04/29/2003 06:21 PM

no need for evaluate....but, are all your form fields uploads controls?? <cfloop list="#FORM.Fieldnames#" index="i"> <cfif i NEQ "">   <CFFILE DESTINATION="#qxdfolder#\#session.ProjectName#\PDFs"   ACTION="UPLOAD"   NAMECONFLICT="MAKEUNIQUE"   FILEFIELD="#i#"> </cfif> </cfloop> I guess to be more precise and scope the var <cfif "form.#i#" NEQ ""> Doug ----- Excess quoted text cut - see Original Post for more -----


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

September 20, 2014

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   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         

Designer, Developer and mobile workflow conference