sglee
asked on
The Value of Description field in Coldfusion does not go away
Hi,
I have CFM page where the description field (TEXTAREA) displays old value even after I replaced it with new text. As seen on the screenshot below, the new value that I assigned to Description field shows the new text and immediately followed by old text.
Old Value: "VERY CLEAN! Conestoga Kit, Air Ride Slider, 48x96 Steel Flatbed, 22.5 11 r Tires & Wheels, 50% Brakes & Tires"
New Value "Swing doors, spring ride slider, 22.5 low pro tires, 3 side doors (curb side) spring ride slider".
Here is my CF code:
<td colspan="2"><b>Description :
</td> </tr> <tr> <td colspan="2"> <TEXTAREA NAME=Description ROWS=5 COLS=33 WRAP="VIRTUAL"><cfoutput># GetFeature dItems.Des cription#< /cfoutput> </TEXTAREA ></td> </tr>
When I open the table in MS ACCESS, I see the new text in Description field and I do not see old text. I don't know where this old text comes from.
One thing that is very strange is that "VERY CLEAN! Conestoga Kit, Air Ride Slider, 48x96 Steel Flatbed, 22.5 11 r Tires & Wheels, 50% Brakes & Tires" is in two other records on the table along with different Item No and this is what is repeating.
I have CFM page where the description field (TEXTAREA) displays old value even after I replaced it with new text. As seen on the screenshot below, the new value that I assigned to Description field shows the new text and immediately followed by old text.
Old Value: "VERY CLEAN! Conestoga Kit, Air Ride Slider, 48x96 Steel Flatbed, 22.5 11 r Tires & Wheels, 50% Brakes & Tires"
New Value "Swing doors, spring ride slider, 22.5 low pro tires, 3 side doors (curb side) spring ride slider".
Here is my CF code:
<td colspan="2"><b>Description
</td> </tr> <tr> <td colspan="2"> <TEXTAREA NAME=Description ROWS=5 COLS=33 WRAP="VIRTUAL"><cfoutput>#
When I open the table in MS ACCESS, I see the new text in Description field and I do not see old text. I don't know where this old text comes from.
One thing that is very strange is that "VERY CLEAN! Conestoga Kit, Air Ride Slider, 48x96 Steel Flatbed, 22.5 11 r Tires & Wheels, 50% Brakes & Tires" is in two other records on the table along with different Item No and this is what is repeating.
Are you using a CFFORM or regular form?
Can you dump the individual values right before the textarea (but not inside it). Use HTMLEditFormat to be sure it displays any hidden characters:
<td colspan="2">
<!--- debugging code --->
Value: <cfoutput>#HTMLEditFormat( GetFeature dItems.Des cription)# </cfoutput >
<TEXTAREA NAME=Description ROWS=5 COLS=33 WRAP="VIRTUAL">cfoutput>#G etFeatured Items.Desc ription#</ cfoutput>< /TEXTAREA> </td>
Can you dump the individual values right before the textarea (but not inside it). Use HTMLEditFormat to be sure it displays any hidden characters:
<td colspan="2">
<!--- debugging code --->
Value: <cfoutput>#HTMLEditFormat(
<TEXTAREA NAME=Description ROWS=5 COLS=33 WRAP="VIRTUAL">cfoutput>#G
Hm... that looks like the text IS part of the records.
Create a totally separate debug page with only the cfquery. Output the data for each row (no tables or extra html). That should confirm whether the text is actually part of the record or it just seems that way in the html:
<cfoutput query="GetFeaturedItems">
<hr>#TheIDColumnForTheTabl e# ||
<pre>#HTMLEditFormat(GetFe aturedItem s.Descript ion)#</pre >
</cfoutput>
Create a totally separate debug page with only the cfquery. Output the data for each row (no tables or extra html). That should confirm whether the text is actually part of the record or it just seems that way in the html:
<cfoutput query="GetFeaturedItems">
<hr>#TheIDColumnForTheTabl
<pre>#HTMLEditFormat(GetFe
</cfoutput>
ASKER
I am getting an error when I run the code above:
"Variable THEIDCOLUMNFORTHETABLE is undefined. "
"Variable THEIDCOLUMNFORTHETABLE is undefined. "
That's just a placeholder for the query column containing the record id. :) Now I see it's literally named "ID", so just replace it with #ID#
ASKER
I ran the following code on a separate CFM page:
<CFQUERY NAME="GetCategory" datasource="CCT">
SELECT *
FROM Category
ORDER BY Category
</CFQUERY>
<CFQUERY NAME="GetFeaturedItems" datasource="CCT">
SELECT Inventory.* , Category.Category
FROM Inventory, Category
WHERE Inventory.CategoryID = Category.ID
</CFQUERY>
<cfoutput query="GetFeaturedItems">
<hr>#ID#
<pre>#HTMLEditFormat(GetFe aturedItem s.Descript ion)#</pre >
</cfoutput>
24 Swing doors, spring ride slider, 22.5 low pro tires, 3 side doors (curb side) spring ride slider
25 VERY CLEAN! Conestoga Kit, Air ride slider, 48x96 steel flatbed, 22.5 11r tires & wheels, 50% brakes & tires
26 Swing doors, spring ride slider, 22.5 low pro tires, 3 side doors (curb side) spring ride slider.
27 Please call for the best deal!
28 VERY CLEAN! Conestoga Kit, Air Ride Slider, 48x96 Steel Flatbed, 22.5 11 r Tires & Wheels, 50% Brakes & Tires
<CFQUERY NAME="GetCategory" datasource="CCT">
SELECT *
FROM Category
ORDER BY Category
</CFQUERY>
<CFQUERY NAME="GetFeaturedItems" datasource="CCT">
SELECT Inventory.* , Category.Category
FROM Inventory, Category
WHERE Inventory.CategoryID = Category.ID
</CFQUERY>
<cfoutput query="GetFeaturedItems">
<hr>#ID#
<pre>#HTMLEditFormat(GetFe
</cfoutput>
24 Swing doors, spring ride slider, 22.5 low pro tires, 3 side doors (curb side) spring ride slider
25 VERY CLEAN! Conestoga Kit, Air ride slider, 48x96 steel flatbed, 22.5 11r tires & wheels, 50% brakes & tires
26 Swing doors, spring ride slider, 22.5 low pro tires, 3 side doors (curb side) spring ride slider.
27 Please call for the best deal!
28 VERY CLEAN! Conestoga Kit, Air Ride Slider, 48x96 Steel Flatbed, 22.5 11 r Tires & Wheels, 50% Brakes & Tires
Are those the same records in the screen shots? The id's are different, so I'm not sure where record begins and ends without the "||" and "<hr>".
ASKER
Sorry I dumped all records from the table. Here are the records IDs and corresponding Item No shown on EE ID: 40924890
Record ID ItemNo
26 1012
27 1015
28 1016
26 Swing doors, spring ride slider, 22.5 low pro tires, 3 side doors (curb side) spring ride slider.
27 Please call for the best deal!
28 VERY CLEAN! Conestoga Kit, Air Ride Slider, 48x96 Steel Flatbed, 22.5 11 r Tires & Wheels, 50% Brakes & Tires
Record ID ItemNo
26 1012
27 1015
28 1016
26 Swing doors, spring ride slider, 22.5 low pro tires, 3 side doors (curb side) spring ride slider.
27 Please call for the best deal!
28 VERY CLEAN! Conestoga Kit, Air Ride Slider, 48x96 Steel Flatbed, 22.5 11 r Tires & Wheels, 50% Brakes & Tires
Ok, then that confirms the text really isn't part of the db record, and it's likely something to do with your output code. I'm trying to avoid you having to post the code for the entire page, so first ... are you using a "grouped" cfoutput query="...." anywhere in that page? Edit: Or maybe nested <cfoutput> tags?
Hm... curious, looking at the screen shots the first table seems to contains all 3 descriptions (26,27,28), the 2nd one contains (27,28) and the last one contains only (28).
ASKER
Here is the code:
Here is CFM page in a nutshell:
<CFFORM name="form1" Method=POST ACTION="ListInventory.cfm" >
<tr>
<td>
<table width=880 border=0 cellpadding=0 cellspacing=0 valign="middle" align="center" style="border:1px outset black;">
<td bgcolor="ffffff" align="left"> & nbsp;<font FACE="verdana,arial,helvet ica" size=2>
<SELECT NAME="CategoryID">
<OPTION VALUE="0"></OPTION>
<CFOUTPUT query="GetCategory">
<OPTION VALUE="#ID#">#Category#</O PTION>
</CFOUTPUT>
</SELECT>
</TD>
<TD bgcolor="ffffff" colspan=5 align=center>
<INPUT TYPE=SUBMIT Name"Submit_Btn" VALUE="List Inventory">
</table>
</CFFORM>
</div>
<CFQUERY NAME="GetFeaturedItems" datasource="CCT">
SELECT Inventory.* , Category.Category
FROM Inventory, Category
WHERE Inventory.Featured = 'Y'
AND Inventory.CategoryID = Category.ID
</CFQUERY>
<div>
<TABLE width=880 border="0" cellpadding="1" cellspacing="1" align="center" >
<cfoutput query="GetFeaturedItems">
<td align="center" >
<table border="0" Style="border:2px outset black;">
<tr>
<TD align="center" bgcolor="DDDDDD">
<table width="100%" border="0" align="center">
<tr>
<td bgcolor="005BA4" colspan="2" align="center" height="60px" width="220px">
<font color="ffffff"> <B>#Title#</B></font>
</td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="FFFFFF"><img border="0" width = "220" height="120" src="http://www.domain.com/ImageUpload/#pic1#"><BR>
</td>
</tr>
<tr>
<td>
<b>Condition:
</td>
<td><font color="990000">#Condition# </font></b >
<td><b>Item No:</b>
</td>
<td>#ItemNo#
</td>
</tr>
<tr>
<td><b>Price:</b>
</td>
<td>#numberformat(Price, "$(,.00)")#
</td>
</tr>
<tr>
<td colspan="2"><b>Description :</b><BR>
<cfoutput>#HTMLEditFormat( GetFeature dItems.Des cription)# </cfoutput >
</td>
</tr>
<tr>
<td colspan="2"> <TEXTAREA NAME=Description ROWS=5 COLS=33 ><cfoutput>#Description#</ cfoutput>< /TEXTAREA>
</td>
</tr>
<tr>
<td colspan="2" align="center"><img src="/images/img_call.jpg" border="0">
</td>
</tr>
</table>
</TD>
</tr>
</table>
</td>
<cfif GetFeaturedItems.currentRo w mod 3 eq 0>
<cfif GetFeaturedItems.currentRo w gt 1>
</tr>
</cfif>
<tr>
</cfif>
</cfoutput>
<TR><TD > </TD></ TR>
<tr>
<!--<TD> </TD>-->
<td align="center"></td>
</tr>
<tr>
<TD colspan=3> &nbs p;</TD>
</tr>
<!--<tr>
<td colspan="3"><br />
</td>
</tr>-->
</table>
Here is CFM page in a nutshell:
<CFFORM name="form1" Method=POST ACTION="ListInventory.cfm"
<tr>
<td>
<table width=880 border=0 cellpadding=0 cellspacing=0 valign="middle" align="center" style="border:1px outset black;">
<td bgcolor="ffffff" align="left"> &
<SELECT NAME="CategoryID">
<OPTION VALUE="0"></OPTION>
<CFOUTPUT query="GetCategory">
<OPTION VALUE="#ID#">#Category#</O
</CFOUTPUT>
</SELECT>
</TD>
<TD bgcolor="ffffff" colspan=5 align=center>
<INPUT TYPE=SUBMIT Name"Submit_Btn" VALUE="List Inventory">
</table>
</CFFORM>
</div>
<CFQUERY NAME="GetFeaturedItems" datasource="CCT">
SELECT Inventory.* , Category.Category
FROM Inventory, Category
WHERE Inventory.Featured = 'Y'
AND Inventory.CategoryID = Category.ID
</CFQUERY>
<div>
<TABLE width=880 border="0" cellpadding="1" cellspacing="1" align="center" >
<cfoutput query="GetFeaturedItems">
<td align="center" >
<table border="0" Style="border:2px outset black;">
<tr>
<TD align="center" bgcolor="DDDDDD">
<table width="100%" border="0" align="center">
<tr>
<td bgcolor="005BA4" colspan="2" align="center" height="60px" width="220px">
<font color="ffffff"> <B>#Title#</B></font>
</td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="FFFFFF"><img border="0" width = "220" height="120" src="http://www.domain.com/ImageUpload/#pic1#"><BR>
</td>
</tr>
<tr>
<td>
<b>Condition:
</td>
<td><font color="990000">#Condition#
<td><b>Item No:</b>
</td>
<td>#ItemNo#
</td>
</tr>
<tr>
<td><b>Price:</b>
</td>
<td>#numberformat(Price, "$(,.00)")#
</td>
</tr>
<tr>
<td colspan="2"><b>Description
<cfoutput>#HTMLEditFormat(
</td>
</tr>
<tr>
<td colspan="2"> <TEXTAREA NAME=Description ROWS=5 COLS=33 ><cfoutput>#Description#</
</td>
</tr>
<tr>
<td colspan="2" align="center"><img src="/images/img_call.jpg"
</td>
</tr>
</table>
</TD>
</tr>
</table>
</td>
<cfif GetFeaturedItems.currentRo
<cfif GetFeaturedItems.currentRo
</tr>
</cfif>
<tr>
</cfif>
</cfoutput>
<TR><TD > </TD></
<tr>
<!--<TD>
<td align="center"></td>
</tr>
<tr>
<TD colspan=3> &nbs
</tr>
<!--<tr>
<td colspan="3"><br />
</td>
</tr>-->
</table>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@agx
That was it. I had redundant <cfoutput>... </cfoutput> around #Description#
Thank you for pointing that out. You are so good!!!
That was it. I had redundant <cfoutput>... </cfoutput> around #Description#
Thank you for pointing that out. You are so good!!!
Yeah, it's one of those minor things that is very easy to overlook but creates some really unexpected results. Glad I could help :)
ie <cfdump var="#GetFeaturedItems#">