It just so happens I was working on a similar problem. Here's how I approached the problem
 
<cfloop collection="#form#"  item="element">
     <cfif left(element,3) eq "Chk">
 
each element that I was interested in had a name beginning with "CHK". In your case once it's known that element is a Question then you can process those answers. And since the loop terminates when no more elements are present the issue of knowing how many questions were asked is solved.
 
Hope this helps
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Bob
Sent: Tuesday, February 10, 2004 10:01 AM
To: [EMAIL PROTECTED]
Subject: [KCFusion] dynamically names vars

I think i need an extra brain on this.
I have a form which can be seen at www.keys.org/modules/quiz.cfm
 
Obviously the names of each set of answers have to be unique. The problem is that the number of questions is not constant so when I go to access these values in the action page i can't just say form.question1 form.question2 etc. I was trying to figure out some way to dynamically reference the field values but that does not look like its going to work. Anybody got a better idea?
 
Adaryl "Did you reboot?" Wakefield
Aviator by passion
Programmer by sheer force of will

Reply via email to