Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
Norman #1
Processing multiple checkbox responses
I'm now at my wits end on this-
A question on a test has 2 correct answers, "ans_b" and "ans_c".
In the DB, the "ans_correct" field contains both values, comma
separated, (ans_b, ans_c).
The test question has three choices, and is set up:
<li><input type="checkbox" name="q01_ch01" value="ans_a">#ans_a#</li>
<li><input type="checkbox" name="q01_ch02" value="ans_b">#ans_b#</li>
<li><input type="checkbox" name="q01_ch03" value="ans_c">#ans_c#</li>
</ol>
Please reveal how you would code the action page that tallies the
correct answers for multiple checkbox responses!?
For answers in the test that have one correct answer, radio buttons were
used. Processing those are easy:
<CFSET num_correct =0>
<cfquery datasource="somedata" name="get_03">
SELECT quest_ID, ans_correct
FROM sometable
WHERE quest_ID = 3
</cfquery>
<cfoutput query="get_03">
<cfif #form.ans_03# eq #ans_correct#>
<CFSET num_correct = num_correct +1>
<cfelse><CFSET 'num_correct' = num_correct +0>
</cfif></cfoutput>
There are other ways to do this too?
Thanks-
Norman Guest
-
CF application processing one command multiple times
I have a CF web application that clients use to order parts with. Today one user added a new line to the order form then submitted it. Then the... -
processing multiple forms
Hi, I am currently using several forms for submitting data and as each form is submitted then it is delt with and then the next page is called. But... -
Need Help Processing Checkbox Form Elements
What I'm doing: I'm pulling news releases form an SQL DB that have a status of 0. I'm using CFOUTPUT QUERY to output all the records into a table.... -
Inserting multiple checkbox values
Hi There I have a list of items (approximately 500) generated from the database. Each item has a checkbox next to it. I now need to insert all... -
processing form with multiple selects
Hello, I have a form with multiple selects (pullDown). All selects have the same name but each select has a different value. The user selects a...



Reply With Quote

