Solved

escape apostrophe's in cf cariable

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now