Ahh...found a one-letter js solution. There is no replaceAll function in js. However, adding a "g" modifier changes a single occurrence replace function to a replace all function.
So, using out.push('<div id="sectionTextDIV">' + row[4].replace(/\r?\n/g, '<br/>') + '</div>'); causes all the line feeds to be replaced by <br/> . However, I appreciate the idea for how to do this in CFML. There will come a time, I'm sure when it's preferable, or perhaps, even necessary. And I do like the idea of modifying the data before sending it back, instead of afterwards...more flexibility. Rick On Sun, Apr 19, 2009 at 9:53 PM, Charlie Griefer <charlie.grie...@gmail.com>wrote: > > wasn't meant to be quite as "snippy" as it came across. new laptop, > and i had set the touchpad to click "on tap"... well, the tap is very > sensitive and i tapped inadvertently and sent the msg prior to adding > a smiley. > > don't get me wrong, there was a certain amount of snippiness > intended... but not 100% snip :) > > anyway, back on topic... i still say play to your strengths and return > the data in the format that's as close as possible to what you want it > to be. write a utility method that takes the query object as an > argument, does the replace on the text, and passes back an array of > structs. this way, you're not bound to returning the data in that > format. you can still return it as a query (if you want), or you can > pass it off to the new method that converts it. > > or, just to blow your mind, you can do the replace in the SQL and > return to CF exactly what you need :) > > On Sun, Apr 19, 2009 at 6:47 PM, Rick Faircloth > <r...@whitestonemedia.com> wrote: > > Now, Charlie...no need to be so "snippy". :o) > > > > Just because I have complaints that JS isn't like CF in some ways, > > doesn't mean I don't want to grow in my understanding and application of > JS. > > > > Anyway, your method is a lot more code, and may be slower than > > using the replace in the JS. > > > > I just wanted to see how it performed. > > > > Now, I think it's about bedtime for someone.... ;o) > > > > Rick > > > > On Sun, Apr 19, 2009 at 7:22 PM, Charlie Griefer < > charlie.grie...@gmail.com> > > wrote: > >> > >> On Sun, Apr 19, 2009 at 3:58 PM, Rick Faircloth > >> <r...@whitestonemedia.com> wrote: > >> > That worked, Ricardo...to a point. > >> > (Haven't tried your solution, Charlie...) > >> > > >> > I actually just embedded the replace function in the code like this: > >> > > >> > out.push('<div id="sectionTextDIV">' + row[4].replace(/\r?\n/, > '<br/>') > >> > + > >> > '</div>'); > >> > > >> > and that worked, but only for the first line break in the text. > >> > > >> > I tried adding 'all', like I do when I use the replace function in > CFML, > >> > but it had no effect. > >> > > >> > ...'<br/>', 'all') + '</div>'); > >> > > >> > Suggestions? > >> > >> Sure. I suggest you return the data in the format that you need it to > be > >> in. > >> > >> You've complained in the past that JS isn't like CF. Here's a place > >> where you can play to your strengths and manipulate the string prior > >> to returning it from the remote CFC call. > >> > >> -- > >> I have failed as much as I have succeeded. But I love my life. I love > >> my wife. And I wish you my kind of success. > >> > > > > > > > > -- > > > ----------------------------------------------------------------------------------------------------------------------------------------------------------------- > > "It has been my experience that most bad government is the result of too > > much government." - Thomas Jefferson > > > > > > -- > I have failed as much as I have succeeded. But I love my life. I love > my wife. And I wish you my kind of success. > > -- ----------------------------------------------------------------------------------------------------------------------------------------------------------------- "It has been my experience that most bad government is the result of too much government." - Thomas Jefferson