Coldfusion, Jquery and special characters
Posted on 2012-04-09
I am using jquery to populate a form. Here is the way that I am doing it:
The problem I'm running into is special characters. Users are entering single quotes (which in this case works), double quotes, and hitting <enter> after lines. How can I fix this so it will show all the special characters without having problems.
I'm not too good at regular expressions, but I gave it a shot and here is what I've tried so far:
<cfset aNote = #REReplace(admin_note,"([\'\""])","\\\1", "all")#>
This works to a point. The problem is that in my textarea it shows:
"This is a 'test'"
The single quotes work the way I want, but I don't want ", i actually want the " to show. Plus I have no idea what to do with a <enter>
Another issue is that I have a TON of fields that this effects. What is the easiest way to do this without having to use cfset on every field? I would assume a function...but i'm fairly new to jquery.
Thanks in advance for your help