FWIW If you loop over the form struct you will have an additional field
"FIELDNAMES" in addition to the form fields themself.
----- Original Message -----
From: "Dave Watts" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, November 20, 2000 9:42 AM
Subject: RE: Kooky Form Field/List question.


> > 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=lists

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

Reply via email to