I usually use this sor of set up.
Answer_QID_[QuestionNumber] as the variable name.
Then I can loop over the fieldnames variable returned, looking at the first
portion of the variable name to see if it is an Answer variable. If it is,
I take action, using the listgetat() function. The trick here is to use the
_ character as the delimiter. Get the second item in the list and you have
the ID, listlast(variable,"_") to get the question number that was
submitted... ie form.Answer_243_1 Would be the answer given for Question ID
243 out of my database and question 1 as presented on the site. Keeping
track of the QuestionNumber, you can determine if they failed to answer a
question and which one.
Works for me anyway.
Heath
-----Original Message-----
From: Jeffrey Thomas [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 30, 2001 2:56 PM
To: CF-Talk
Subject: Problems with Dynamic Form.variables
I am trying to create a dynamic quiz and I am having problems with the form
variables. I create questions and possible answers using a form which asks
for the question and if it is true/false or multiple choice. When I select
true/false it presents me with the option of selecting true or false as the
correct answer. If I select multiple choice it presents me with a form to
input the multiple possible answers and radio buttone for marking the
correct answer for grading later. This all works fine and I can list the
questions and select options (weather it be true, false or the multiple
choice possible answers depending on the type of question. All of the
possible answers have a radio button for selecting it as the correct answer
and the input fields are named #qid# or question id number. The problem I am
having is that when the selections are made and the form is submitted for
grading I cannot figure how to identify the #form.???# that is holding the
value of the selected answer. If the qids are 1 through 10 for example, how
do I set up my query to find the correct answer using WHERE qid=#form.???# ?
Any help will be appreciated,
Jeff Thomas
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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