Solved

escape apostrophe's in cf cariable

Posted on 2004-08-25
4
362 Views
Last Modified: 2013-12-16
I am using the Overlib js file for some custom tooltips on my pages. In order to pass the text from my coldfusion variable into the ToolTip function I call it like this:

onmouseover="return overlib('#problem#');" onmouseout="return nd();"

The error occurs when the #problem# variable conatins apostrophes, for obvious reasons. I am wondering if anyone has some code that will escape all of the apostrophes in the #problem# variable and return with all of the ' turned into /' (if that's right, I think)  Keep in mind I need to be able to pass #problem# as a parameter of the function.

Once again, I deeply appreciate everyone's support.

Adam
0
Comment
Question by:FirePits
  • 2
4 Comments
 
LVL 14

Expert Comment

by:ziffgone
ID: 11898604
Try this:

onmouseover="return overlib(escape('#problem#'));"

Then, in the overlib function:

function overlib(xValue){
      document.write('This is the Value sent: '+unescape(xValue));
 
~~ Other code ~~

}

So, where you want to insert the value of #problem# in your overlib code, instead use "unescape(xValue)".

Hope that helps, not sure though without seeing more code.

Regards...
0
 
LVL 4

Accepted Solution

by:
reggi635 earned 250 total points
ID: 11904247
onmouseover="return overlib('#JSStringFormat(problem)#');" onmouseout="return nd();"

JSStringFormat is a inbuilt ColdFusion to do the same as escape.

REGGI
0
 
LVL 1

Author Comment

by:FirePits
ID: 11905202
Thanks!
0
 
LVL 4

Expert Comment

by:reggi635
ID: 11906249
You are welcome.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses how to create an extensible mechanism for linked drop downs.
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

839 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