Link to home
Start Free TrialLog in
Avatar of sglee
sglee

asked on

The Value of Description field in Coldfusion does not go away

User generated imageUser generated imageHi,
 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>#GetFeaturedItems.Description#</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.
Avatar of _agx_
_agx_
Flag of United States of America image

If you dump the raw query used to populate the text field, does it contain both the old + new text?
ie <cfdump var="#GetFeaturedItems#">
Avatar of sglee
sglee

ASKER

Here is the dump and item listing on the webpage along with MS access records.
User generated imageUser generated imageUser generated image
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(GetFeaturedItems.Description)#</cfoutput>

<TEXTAREA NAME=Description ROWS=5 COLS=33 WRAP="VIRTUAL">cfoutput>#GetFeaturedItems.Description#</cfoutput></TEXTAREA></td>
Avatar of sglee

ASKER

Here it is:User generated image
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>#TheIDColumnForTheTable# ||
<pre>#HTMLEditFormat(GetFeaturedItems.Description)#</pre>
</cfoutput>
Avatar of sglee

ASKER

I am getting an error when I run the code above:
"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#
Avatar of sglee

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(GetFeaturedItems.Description)#</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
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>".
Avatar of sglee

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
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).
Avatar of sglee

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;&nbsp;&nbsp;<font FACE="verdana,arial,helvetica" size=2>
                  <SELECT NAME="CategoryID">
                    <OPTION VALUE="0"></OPTION>
                  <CFOUTPUT query="GetCategory">
                  <OPTION VALUE="#ID#">#Category#</OPTION>
                  </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:&nbsp;&nbsp;
                              </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(GetFeaturedItems.Description)#</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.currentRow mod 3 eq 0>
  <cfif GetFeaturedItems.currentRow gt 1>
     </tr>
  </cfif>
     <tr>
  </cfif>
         </cfoutput>
      <TR><TD >&nbsp;&nbsp;&nbsp;</TD></TR>
      <tr>
            <!--<TD>&nbsp;&nbsp;&nbsp;</TD>-->
          <td align="center"></td>
            
      </tr>
      <tr>
            <TD colspan=3>&nbsp;&nbsp;&nbsp;</TD>
      </tr>
      <!--<tr>
      <td colspan="3"><br />
      </td>
      </tr>-->
</table>
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sglee

ASKER

@agx

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 :)