I'm trying to pass a string to a JavaScript confirm box and everything works
great until the string has single quote. I'm creating a dynamic list of
terms and I get a JavaScript error for every term that has a single quote in
it.
Here's the code:
JavaScript Function:
<script>
function confirmDelete(term) {
var makeSure = confirm("Are you sure you want to delete '" + term + "' ?");
if (makeSure) {
return true;
}
return false;
}
</script>
CF Link:
<a href="index.cfm?fuseaction=deleteterm&tID=#qTermsbyowner.tID#"
onClick="javascript:return
confirmDelete('#qTermsbyowner.term#')">[Delete]</a>
I've tried PreserveSingleQuotes and URLEncodedformat but neither did the job
correctly. PreserveSingle..... doesn't do anything and URLEncoded.... will
eliminate errors, but passes space (%20) characters to every term which has
a space, which is unacceptable.
What formatting function will escape that single quote properly?
Any help is much appreciated....
Ryan
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.