yes, despite what someone said earlier, the FORM is a structure in 4.5+.
chris olive, cio
cresco technologies
[EMAIL PROTECTED]
http://www.crescotech.com
-----Original Message-----
From: Willy Ray [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 20, 2000 7:39 PM
To: CF-Talk
Subject: RE:Dave: Kooky Form Field/List question.
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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=sts
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists