Hi CF listers,
I have an application that needs to use a variable to identify a form field
with two components. While the form build correctly and functions as it
should, I am encountering a problem when I try to save the changes made to
the form to the Oracle 8 database.
The form fields which are passed contain a comma (thought I've alternated
and removed delimiting characters with no success) and the SQL statement
balks at the passed value when it hits the comma.
The General form of the passed field name value is: cost,100000234.

To access these form values I need to loop over the  variable numeric
component and do a simple insert
current code is like this:

the values are stored in the form as:

<input type="text" name="quantity,#keyArray[counter]#" value="numeric
value">
<input type="text" name="cost,#keyArray[counter]#" value="numeric value">

where #keyArray[counter]# is a numeric value based on the db primary key for
the displayed value.
 so that the form field value for: cost,100000234 = some number

The resulting output dynamically creates an interactive form that allows
changes to the displayed values without any database interaction (other than
calculations).  The problem occurs when passing form fields thus constituted
to the insert statement when the user decides to save the value. All values
pass perfectly, but I can't seem to get around the comma in the SQL
statement. the statement balks at: the first instance of:
#form.quantity,keyArray[counter]# in the statement below.  I've tried
various workarounds including changing or eliminating the comma in the form.
Any tips? original code follow

<cfset myList = "#form.system_key_save#">   //this outputs the number value
to loop over
<cfset keyArray = #ListToArray(myList)#>
<cfloop from=1 to=#ListLen(myList)# index=counter>
<cfoutput>
<cfquery name="qry_saveissue" datasource="#str_dsn#">
Insert into issue_values(issue_name,system_key,quantity,cost)

VALUES('#form.issue_name#',#keyArray[counter]#,#form.quantity,keyArray[count
er]# ,#form.cost,#keyArray[counter]# )
</cfquery>
</cfloop>

Any new approaches or concepts welcome!
Michael Miller
Certified ColdFusion 5 Developer
Information Spectrum Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to