You could do a "while" condition if you didn't want to use "FORM.FieldNames"
(for instance, if you had other form vars that were getting passed along
that you didn't want to deal with):
<CFSET i = 1>
<CFSET lstFormVarList = ''>
<CFLOOP Condition="isDefined('FORM.Section' & i)">
<CFSET lstFormVars = lstFormVars & 'FORM.Section#i#' & ','>
<CFSET i = i + 1>
</CFLOOP>
Then to get their values, you can loop through the list and Evaluate() each
variable.
--OR--
take what FORM.FieldNames gives you and Evaluate them to get the values:
<CFLOOP From="1" To="#ListLen(FORM.FieldNames)#" Index="j">
<CFSET somevalue = Evaluate('FORM.' & ListGetAt(FORM.FieldNames, j))
</CFLOOP>
HTH,
Robyn
p.s., this is NOT tested... but barring any syntax errors (heh... or logic
errors), it should work.
-----Original Message-----
From: Ewok [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 27, 2002 3:03 PM
To: CF-Talk
Subject: Re: Dyanmic Form Names huh?
#form.fieldnames# woudl return
section1,section2,section3,section4
I need the values of
#form.section1#
#form.section2#
#form.section3#
I need to turn them into variables and get their values
any other suggestions??
----- Original Message -----
From: "charlie griefer" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, August 27, 2002 2:23 PM
Subject: Re: Dyanmic Form Names huh?
> hi ewok:
>
> you can loop over #form.fieldNames#, which is a list-variable of all of
the,
> well, form field names :)
>
> charlie
>
>
> Ewok writes:
>
> > Ok, so I have a database full of sections in the admin section
> >
> > section1
> > section2
> > section3
> > section4
> >
> > no problem looping over them to create a dynamic form
> >
> > <cfloop query="getsections" datasource="#request.maindsn#"
dbtype="ODBC">
> >
> > <cfoutput>
> >
> > #getsections.sectionname#
> >
> > <select name="#sectionname# size="1">
> > <option value="yes"> YES </option>
> > <option value="no"> NO </option>
> > </select>
> >
> > </cfoutput>
> >
> > </cfloop>
> >
> > so I have a form that sorta resembles my artwork below.....
> > ___________
> > Section 1 |___YES___|/\|
> > ____________
> > Section 2 |____NO___|/\|
> > ___________
> > Section 3 |____YES___|/\|
> > ____________
> > Section 3 |____NO___|/\|
> >
> > hehe those are drop down selects......no really they are!
> >
> > ok so the form is simple enough
> >
> > now when i process the template (send it to act_process.cfm)
> >
> > I want to make a list of all the selections that were YES
> >
> > ............. section1,section3 from my beautiful example ; )
> >
> > but i cant say
> >
> > <cfif form.#section1# IS "yes">
> > listappend(blahblahblah
> > </cfif>
> >
> > in a loop
> >
> > HOW CAN I GET THESE FORM NAMES THEIR VALUES AND !!!! *cough* sorry i
yelled
> >
> >
>
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists