> i am looping through theform and collecting survey answers, if i 
> select multiple answers they get inserted on one line how can i insert 
> the value individulay? How can i modify the code so i can make the 
> code work the way i need 
> 
> <cfif isDefined("btnSubmitSurvey")>
> <cfoutput>
> <cfif isDefined("form.fieldnames")>
> <CFLOOP LIST="#form.fieldnames#" Index="field">
> <cfif #field# neq "btnSubmitSurvey">
> <cfquery name="qryInsert" datasource="cfelsunrise" dbtype="odbc">
                
> insert into answers (questionidfk,answer,empID,surveyID) values 
> (#ListLast(Evaluate("Form.#field#"),"_")#,'#Evaluate(field)#',#session.
> empID#,#url.survey#)
        
> 
        
> 
        
> </cfquery> 

If I understand your question correctly (one to multiple answers to one quesion 
with checkbox) then one efficient way to capture the data would be something 
like the following (you have to work on it...):

<cfif isDefined("FORM.btnSubmitSurvey")>

<!--- get the FORM elements with data --->
<cfif #field# neq "btnSubmitSurvey">
// the element list ...
</cfif>

<cfquery name="qryInsert" datasource="cfelsunrise" dbtype="odbc">
<cfoutput>
 <CFLOOP LIST="#theList#" Index="field">                
 insert into answers (questionidfk,answer,empID,surveyID) values 
 (#ListLast(Evaluate("Form.#field#"),"_")#,'#Evaluate(field)#',#session.
 empID#,#url.survey#);
// try not to Evaluate function here...
 </CFLOOP>
<cfoutput>      
</cfquery> 
 
</cfif>




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:304618
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to