Passing ColdFusion strings to client-side JavaScript is easy – all you need to do is refer to the variable in your JavaScript code and when ColdFusion parses the code it’ll replace the variable with the string. But what if the string contains special characters -characters that are invalid within JavaScript text? The solution is to use the CFML JSStringFormat() function which takes a string and returns a JavaScript safe version of it for you to use. (Applies to: ColdFusion 4.5 (or later))

Leave a Reply