[thelist] Coldfusion: getting javascript variables

Erik Mattheis gozz at gozz.com
Tue Jan 8 22:44:30 CST 2002


>erik,
>
>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
>>  From: Erik Mattheis
>>
>>  <cfset temp = QuerySetCell(my_query, "name"
>>              , #Evaluate("#form.item" & #this_item# & "Name")#)>
>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
>
>no offense, but the bit of code you submitted has lots of redundant hashes
>that are completely unnecessary (sloppy and very difficult to parse with the
>eyes) which is prone to cause problems i've found through some of my reading
>and experience.  in addition, the Evaluate() function is completely
>unnecessary.

I never use unnecessary hashes - but the books and resources I 
learned from always used them and I was shocked when I found out you 
hardly ever need to ... I maybe wrongly assumed it would be more 
understandable to someone just learning CF to have them in there ... 
indeed, they confused the hell out of me ... (and ted) ... this is 
what I would have done (and did).

<cfset my_query=QueryNew("name,action,x")>
<cfloop from="1" to="#form.num_items#" index="this_item">
	<cfset temp=QueryAddRow(my_query)>
	<cfset temp=QuerySetCell(my_query,"name",Evaluate("form.item" 
& this_item & "Name"))>
	<cfset 
temp=QuerySetCell(my_query,"action",Evaluate("form.item" & this_item 
& "Action"))>
	<cfset temp=QuerySetCell(my_query,"x",Evaluate("form.item" & 
this_item & "X"))>
</cfloop>


>
>#Evaluate("#form.item" & #this_item# & "Name")#
>
>could be rewritten to simply be:
>
>#form["item" & this_item & "name"]#

Yeah, I suppose it could, couldn't it! Didn't catch my wrongly placed 
hash though!

I do perhaps overuse evaluate and eval one could say if one wanted to 
... but I still get a whisp of that warm fuzzy feeling I got when I 
first understood what it did ... I was ONE with the MACHINE!
-- 

__________________________________________
- Erik Mattheis

(612) 377 2272
http://goZz.com/

__________________________________________




More information about the thelist mailing list