Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Invalid CFML Error when using Replace Function

Posted on 2011-09-30
2
Medium Priority
?
271 Views
Last Modified: 2012-05-12
Hi,

I am using the replace function to clean up some html content.  Some of the text is in quotes and I believe that is why I am getting the error.  Anyway around this?
Thanks in advance!

<cfcomponent>
   
    <cffunction name="createEditorFile1" access="remote" returnType="string">
      <cfargument name="data" type="string" required="true">
         <cfargument name="GroupNo" type="string" required="true">
          <cfargument name="NPSGroupNumber" type="string" required="true">
         <cfargument name="NPSGroupSection" type="string" required="true">
          <cfargument name="BPIDReg" type="string" required="true">

             <cfset cleanData = replace(#cleandata#,"<th class="col1" />","<th class="col1">&nbsp;</th>","all")>
               
      <cfreturn cleanData>
    </cffunction>
   
   
</cfcomponent>
       
0
Comment
Question by:armanbena
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 2000 total points
ID: 36892713

You have nested quotes in your statement...  you cannot enclose quotes within quotes unless they are escaped or different types of quotes

   <cfset cleanData = replace(#cleandata#,"<th class="col1" />","<th class="col1">&nbsp;</th>","all")>

Enclose in single quotes instead (and of course get rid of the useless #s around cleanData)

   <cfset cleanData = replace(cleandata,'<th class="col1" />','<th class="col1">&nbsp;</th>',"all")>
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question