Ok we have a survey where we have to rate each person in 3 categories.
We have 50 people to rate.
I set a comma delimited list of names and then create a loop to create 3
questions
for each person, so we can rate each of the 50 people in the 3 categories.
Looks like this:
<cfloop index="Surname" list="#ChunkLast#">
<cfset ChunkFirstIndex = ChunkFirstIndex +1>
<cfinput type="radio" name="#trim(Surname)#_Comm" value="1"
style="background: white">
<cfinput type="radio" name="#trim(Surname)#_Comm" value="2"
style="background: BBE9FF">
<cfinput type="radio" name="#trim(Surname)#_Comm" value="3"
style="background: 9DCBFF">
<input name="#trim(Surname)#_Comm_required" type="hidden" value="You forgot
to rate <b>#trim(Surname)#</b> for <b>Committed to AAAE Goals,</b>">
<cfinput type="radio" name="#trim(Surname)#_Cust" value="1"
style="background: white">
<cfinput type="radio" name="#trim(Surname)#_Cust" value="2"
style="background: BBE9FF">
<cfinput type="radio" name="#trim(Surname)#_Cust" value="3"
style="background: 9DCBFF">
<input name="#trim(Surname)#_Cust_required" type="hidden" value="You forgot
to rate <b>#trim(Surname)#</b> for <b>Customer Service</b>.">
<cfinput type="radio" name="#trim(Surname)#_Extr" value="1"
style="background: white">
<cfinput type="radio" name="#trim(Surname)#_Extr" value="2"
style="background: BBE9FF">
<cfinput type="radio" name="#trim(Surname)#_Extr" value="3"
style="background: 9DCBFF"><cfinput type="radio"
name="#trim(Surname)#_Extr" value="4" style="background: 5785FF">
<input name="#trim(Surname)#_Extr_required" type="hidden" value="You forgot
to rate <b>#trim(Surname)#</b> for <b>Extra Effort</b>.">
</CFLOOP>
It creates this part fine and as you can see for each category there are 3
radio buttons all
w/ the same name. So if the surname for the first person were smith the
first set of radio
buttons would be named smith_comm, 2nd set smith_cust, 3rd set smith_extr
It does this for all 50 people, works great.
Here is the problem when I hit submit I want to loop through to resolve all
the values rather
than have to type up 200 separate values in the insert statement.
However if I want to loop through on the insert page similarly to how I am
looping through on the
form I can't resolve the variable. Because if I pass a value named
smith_comm
I can't loop through to get the value of smith_comm...
Meaning an insert statement like:
<cfloop index="Surname" list="#ChunkLast#">
<cfset ChunkFirstIndex = ChunkFirstIndex +1>
<CFQUERY datasource="SC2002">
INSERT INTO SCORES
(#trim(Surname)#_Comm)
VALUES
('#trim(surname)#_comm') (obviously that won't work because it will
insert a value of smith_comm instead of say "3" How do I find the value of
smith_comm by looping through? Any ideas??
</CFQUERY>
______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
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