Solved

escape apostrophe's in cf cariable

Posted on 2004-08-25
4
367 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 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
This article discusses how to implement server side field validation and display customized error messages to the client.
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

751 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