Problem with cfloop round session variables
Hi,
I have a multi step form which stores each form variable into a session. At the end of the form I am trying to loop through the session variables and insert the values into a database but I keep getting cfml structure referenced as part of anexpression errors.
Here is my session code (this is stored in application.CFC:
<cfset SESSION.FormData = structNew() />
On the last step of the form, here is my loop:
<!--- lets get the colums from the quote table --->
<cfquery name="selectColumns" datasource="#request.dsn#">
SHOW COLUMNS
FROM INSURANCE_QUOTES
</cfquery>
<!---and lets enter the quote details by looping over the columns--->
<cfquery name="quoteUpdate" datasource="#request.dsn#">
UPDATE INSURANCE_QUOTES
SET HANDLER_ID='#session.userID#',
SCHEME_ID = '#form.insurance_scheme#',
<cfoutput query="selectColumns">
<cfif isdefined("REQUEST.FormData")>
<cfswitch expression="#left(type,3)#">
<cfcase value="dat">
<cf_dateasdata
DateType="#type#"
DateField="#REQUEST.FormData[field]#"
/>
#field# = #ThisDate#,
</cfcase>
<cfcase value="dec,int">
<cfif REQUEST.FormData[field] eq ''>
#field# = null,
<cfelse>
<cfloop from="1" to="#len(variables.numericExclusions)#" index="thisExclusion">
<cfset REQUEST.FormData[field] = replace(REQUEST.FormData[field],mid(variables.numericExclusions,thisExclusion,1),"","All") />
</cfloop>
#field# = '#REQUEST.FormData[field]#',
</cfif>
</cfcase>
<cfcase value="tex,var">
#field# = <cfqueryparam value="#REQUEST.FormData[field]#" cfsqltype="cf_sql_longvarchar" />,
</cfcase>
<cfdefaultcase>
#field# = '#REQUEST.FormData[field]#',
</cfdefaultcase>
</cfswitch>
</cfif>
</cfoutput>
DATE_CREATED = #now()#,
QUOTE_EXPIRY = #quoteExpiry#,
USER_LAST_UPDATED = '#session.userID#'
WHERE QUOTE_ID = '#thisQuote#'
</cfquery>
Can anyone see any problems with my syntax?
I'd appreciate any support ![]()
