I haven't seen this addressed in the archives, so here goes ...
Using CF 4.0.1 Enterprise (Solaris), I want to read in comma-delimited
flat-file data, allow the user to edit it using CFGRID, and then write the
data back out to the flat file. I can read and display the data easily
enough, as follows:
< ... snip ... >
<CFFILE ACTION="Read"
FILE="/oramnt/app1/coldfusion/doc/manufacturing/data/spc/SolderJointBreaking
Strength/SJBS_Data.txt"
VARIABLE="SJBS_Data">
<cfform name="spc_form" action="SJBSsave.cfm" method="POST">
<cfgrid name="spc_grid" colheaderalign = "center"
selectmode="EDIT" insert="YES" delete="YES" width="400">
<cfgridcolumn name="test_date" header="Date">
<cfgridcolumn name="data1" header="A">
<cfgridcolumn name="data2" header="B">
<cfgridcolumn name="data3" header="C">
<cfgridcolumn name="data4" header="D">
<cfgridcolumn name="data5" header="E">
<cfloop index = "InputLine" list = #SJBS_Data# DELIMITERS="#Chr(10)#">
<cfgridrow data="#InputLine#">
</cfloop>
</cfgrid><br><br>
<input type=submit value="Save Changes">
</cfform>
< ... snip ... >
HOWEVER, when writing out the data, the arrays that are supposed to contain
the data in the grid don't contain all the data! They seem to contain only
data that has changed, so that if the user saves the grid data with no
changes, the output to the file is EMPTY, when I do the following in the
page called by the data editing form:
< ... snip ... >
<!--- Loop through the form variables passed from SJBSedit.cfm --->
<!--- Accumulate the row contents in a file for later output --->
<cfset SJBSoutput = "">
<cfloop index="Row" FROM="1" TO=#ArrayLen(Form.spc_grid.test_date)#>
<cfset SJBSoutput = SJBSoutput & #Form.spc_grid.test_date[Row]# &
","
& #Form.spc_grid.data1[Row]# & "," & #Form.spc_grid.data2[Row]# &
","
& #Form.spc_grid.data3[Row]# & "," & #Form.spc_grid.data4[Row]# &
","
& #Form.spc_grid.data5[Row]# & Chr(10)>
</cfloop>
<cffile Action="Write"
File="/oramnt/app1/coldfusion/doc/manufacturing/data/spc/SolderJointBreaking
Strength/SJBS_Data.txt"
Output=#SJBSoutput#
>
< ... snip ... >
I'm sure that others have attempted this in the past. Any suggestions would
be greatly appreciated!
Thanks,
Kevin
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message
with 'unsubscribe' in the body to [EMAIL PROTECTED]