Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2005
    Thanked 0 Times in 0 Posts

    Coldfusion strings

    I'm using the following statement in javascript/coldfusion and need help:

    function somefun()
    var myText = <cfoutput>#editor.text#</cfoutput>

    The problem is, I need to treat myText as a string, and the #editor.text# contains both " and ' characters.... how do I get around the problem of early string termination and such?
    Any help would be appreciated, thanks

  2. #2
    Regular Coder eak's Avatar
    Join Date
    Jun 2002
    Nashville, TN
    Thanked 26 Times in 26 Posts
    i have had similar problems when using WebDNA (tag based server side scripting language). I had to grep the variable before it was sent to the browser. Just use regular expressions to replace " with \" and ' with \'. you may not need to do both. it depends on what your wrapping the js var with ( var txt ="hi" or var txt ='hi' ).
    eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts