Skip to main content
Inspiring
November 18, 2010
Question

Looping over CFFILE only writes last line

  • November 18, 2010
  • 1 reply
  • 515 views

Here is the code in question:

<CFSET LINECOUNT = 0>

<cfloop list="#populate#" index="CL">

      <CFOUTPUT>#CL#:<input type="text" name="#CL#"><BR></CFOUTPUT>
      <CFSET LINECOUNT = LINECOUNT + 1>
      <CFSET ThisNewLine = '<input type="text" name="#CL#">#CL#'>
      <cffile action="append" file="#Application.BaseRef#Temp\#URL.Field#.CFM" output="#ThisNewLine#" addnewline="Yes">
</cfloop>

Linecount = <CFOUTPUT>#LineCount#</CFOUTPUT>

The list populate# has 28 items in it, the output to the screen is 28 lines of input boxes, the line count variable value is 28 but only one line (The last line) is written to the file.

What is the world am I overlooking?

Thanks,

Kev

This topic has been closed for replies.

1 reply

Inspiring
November 18, 2010

Can you provide a more thorough example? Copy of file contents to test with?


KkofalAuthor
Inspiring
November 18, 2010

Well, I went to clean up my code to get rid of all the debug "stuff" I put in there trying to determine the root cause so I could post the whole shebang for you and after I removed all the "stuff" I executed it again to make sure that I didn't introduce a new error and whatever was causing the problem is now no longer there.  I apologize to the community for wasting the bandwidth.

If ignorance is bliss, why am I not happy?