[thelist] Coldfusion: getting javascript variables

.jeff jeff at members.evolt.org
Tue Jan 8 21:21:22 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.

#Evaluate("#form.item" & #this_item# & "Name")#

could be rewritten to simply be:

#form["item" & this_item & "name"]#

now, add to that the fact that it's being called within a function which
tells you you can omit the surrounding hashes.

QuerySetCell(my_query, "name", form["item" & this_item & "name"])

when to hash and when not to hash, is definitely the question.  the answer
is simpler than you might think.  start out by not wrapping things in
hashes.  if it doesn't produce the results you expect, then work your way
from the outside in.  usually wrapping the outermost variable or function
reference with hashes will take care of it.  couple this with good string
concatenation skills and you should be golden with the bare minimum of
hashes in your source code.

good luck,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/








More information about the thelist mailing list