A strange display bug with CFHTTP?
I have a report that is created within a CFLOOP over a list of integers. For each list element, a new report row is produced. Simple, and it works fine.
However, I'm having an intermittent display issue I can't figure out. Only periodically, for the same set of data, if I refresh the report screen I see the display of the last list element in the CFLOOP, e.g. "14" over the report on the screen. Hit refresh a few times it goes away. Some more refreshes and it comes back. At first I thought it was just a missed or unclosed CFOUTPUT, but no luck.
I've traced it so that it only displays that last list element in the CFLOOP. I created a smaller version of the code just for testing. Here is the CFLOOP statement: <cfloop list="10,14" index="ListItem"> Full code is at the bottom of this post.
Here is the output after several refreshes (this is correct).
Start loop for listitem:10
inner loop index=1
inner loop index=2
endloop
Start loop for listitem:14
inner loop index=1
inner loop index=2
endloop
And sometimes if I refresh, I get this output (note the 14, the last element in the CFLOOP list)
Start loop for listitem:10
inner loop index=1
inner loop index=2
endloop
Start loop for listitem:14
14 inner loop index=1
inner loop index=2
endloop
Again, that 14 only appears intermittenty. Inside my loop is a CFHTTP statement. If I comment out this statement, the '14' goes away, but obviously I need that statement. Just trying to track down the issue.
Here's my test code that produced the output above:
<cfloop list="10,14" index="ListItem">
Start loop for listitem:<cfoutput>#ListItem#</cfoutput> <br />
<cfobject component="#application.CFCPath#components.cGroup" name="clientObj">
<cfset ClientGroupInfo = clientObj.ServicePowerInfo(ListItem)>
<cfset ClientGroupDesc = clientObj.getClientGroupInfo(ListItem)>
<cfset ClientGroupCurrent = ClientGroupDesc.CompanyName>
<cfset form.runsheetdate = Now()>
<cfsavecontent variable="my_xml">
<dispatch>
<request>
<userID><cfoutput>#ClientGroupInfo["username"]#</cfoutput></userID>
<companyID><cfoutput>#ClientGroupInfo["companyid"]#</cfoutput></companyID>
<date><cfoutput>#DateFormat(form.runsheetdate,"YYYY-MM-DD")#</cfoutput></date>
</request>
</dispatch>
</cfsavecontent>
<cfset xml_obj = xmlparse(my_xml)>
<cfset webSvcURL = "http://test/test.aspx">
<cfhttp url="#webSvcURL#" charset="utf-8" method="post" ><cfhttpparam type="xml" value="#my_xml#"></cfhttp>
<cfloop index="i" from="1" to="2">
inner loop index=<cfoutput>#i#</cfoutput><br />
</cfloop>
endloop<br /><br />
</cfloop>
Any ideas are welcome!
