On 3/29/00, WBB penned:
>Optionally, you can name them all the same, assign them different
>values...any that are checked will have their values passed as a list. That
>way you only have 1 <CFPARAM> to worry about.
>
> > I have search form that contains a large amount of yes/no check boxes -237
> > to be exact. It is to search the results of a survey that has 237
>questions.

In actuality, unless you explained it wrong, you are saying you have 
237 yes/no checkboxes. If you are using checkboxes, you should only 
have a Yes, and say to click any checkbox that the answer is Yes. 
Otherwise, you'll invariably have some numbskulls that will check 
both yes and no and REALLY play havoc with your survery. :) If you 
need to do Yes/No, use radio buttons and set them all to a default of 
yes or no. Then you won't have to check for existence because each 
question will be passed as either yes or no.

You could easily loop through and evaluate the "fieldnames" variable:

Do your questions with underscores:
Do_You_Smoke?

The replace the underscores in the QuerySetCell tag.

<cfset qrySurvey = QueryNew("Question,Answer")>
<cfloop index="myList" list = "#fieldnames#"><CFIF myList IS NOT 
"Submit" and myList is not (whatever other fields you don't want in 
your query)>
<cfset temp = QueryAddRow(qrySurvey)>
<cfset temp = QuerySetCell(qrySurvey, "Question", replace(myList, 
"_", " ", "ALL"))>
<cfset temp = QuerySetCell(qrySurvey, "Answer", 
evaluate(myList))></CFIF></cfloop>

evaluate(myList) will evaluate to yes or no.

Then:
Here are your survey answers.<p>
<cfoutput query="qrySurvey">
#Question# - #Answer#<br>
</cfoutput>

THE ONLY THING WRONG WITH THIS IS, FOR SOME REASON COLDFUSION LIKES 
TO CHANGE FIELDNAMES TO ALL CAPS.

Wish they'd fix that.


Bud Schneehagen - Tropical Web Creations

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to