?
Solved

escape apostrophe's in cf cariable

Posted on 2004-08-25
4
Medium Priority
?
369 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
[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
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 1000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
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)

718 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