Dave,
The solution looping over list is working, but I'm not getting what you're saying 
about looping over the structure.  I cant seem to access the form as a structure.  I'm 
on CFServer 4.0.  Could that be the problem?  Special feature of 4.5?
Thanks
Willy


>>> Dave Watts <[EMAIL PROTECTED]> 11/20/00 9:42:16 AM >>>
> So, here's the problem. I can use the automatically-created 
> FORM.fieldnames list to get the field names onto the email 
> like this:
>
><cfloop index="test" list="#FORM.fieldnames#" delimiters=",">
> #test# :<br>
></cfloop>
>
> This code puts the names of the form field onto the email.
> Easy. I can also test them for whether or not they're one of 
> my required fields, and not print them if they are. What I 
> can't do is print the VALUE of the form fields. Make sense?
> I was hoping I could do something like this:
>
><cfloop index="test" list="#FORM.fieldnames#" delimiters=",">
> #test# : #FORM.#test##<br>
></cfloop>
>
> Yeah, but I can't. Any thoughts?

Use the Evaluate function to determine the value of a variable whose name
you don't know until runtime:

#test#: #Evaluate("Form." & test)#

In addition, rather than looping over the FIELDNAMES string, you might be
better served by looping over the Form structure itself:

<cfoutput>
<cfloop collection="#Form#" item="i">
#i#: #Evaluate("Form." & i)#
</cfloop>
</cfoutput>

This way, if you have any duplicate field names, such as you'd get with
checkbox arrays, you'll output the fieldname once, followed by a
comma-delimited list of selected values.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/ 
voice: (202) 797-5496
fax: (202) 797-5444

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebarRsts

Reply via email to