loop over the query in your CFC method.  create an array of structs,
and do your replace() function there.  then return the array of
structs in place of the query (a query is really nothing more than an
array of structs anyway).

you don't HAVE to return a query, right?

On Sat, Apr 18, 2009 at 6:33 PM, Rick Faircloth
<r...@whitestonemedia.com> wrote:
> That's one of the thing's I said below that I couldn't see how to do.
>
> The cfc method runs a query and retrieves all the data involved,
> then the query data is stored in storyStruct.QGETSTORYINFO
> and returned to the calling AJAX function.
>
> At what point could I run a regex on the specific piece of data
> from the query?
>
> i.e....
>
> <cfquery name="qGetStoryInfo" datasource="#arguments.dsn#">
>
>      select          ss.story_id, ss.title, sss.section_id, sss.section_text
>      from            success_stories ss, success_sections sss
>      where          ss.story_id = '#arguments.story_id#'
>      and             sss.story_id = '#arguments.story_id#'
>      order by      #arguments.orderBy#
>
> </cfquery>
>
> <cfset     storyStruct.MESSAGE = 'Success'>
> <cfset     storyStruct.QGETSTORYINFO = '#qGetStoryInfo#'>
>
> <cfreturn storyStruct >
>
> I'm not sure where or how I can run the replace function on the individual
> pieces of sss.section_text data in the query result or the struct...
>
> ???
>
> On Sat, Apr 18, 2009 at 9:15 PM, Charlie Griefer <charlie.grie...@gmail.com>
> wrote:
>>
>> why not run the replace in the CF function that's returning the data?
>>
>> On Sat, Apr 18, 2009 at 6:12 PM, Rick Faircloth
>> <r...@whitestonemedia.com> wrote:
>> > Normally, when I'm trying to cause a passage of text to respond to line
>> > breaks, I use this ColdFusion code:
>> >
>> > #replace(myText, '#chr(13)#', '<br>', 'all')#
>> >
>> > and that keeps the line breaks intact when the text is output to the
>> > screen.
>> >
>> > But how can I write that code inside this js?  Or do I have to do it
>> > outside
>> > the js?
>> > ("row[4]" represents the text)
>> >
>> > out.push('<div id="sectionTextDIV">' + row[4] + '</div>');
>> >
>> > out.push('<div id="sectionTextDIV"><cfoutput>#replace(' + row[4] + ',
>> > '#chr(13)#', '<br>', 'all')#<cfoutput></div>');
>> >
>> > That wouldn't work anyway, since the HTML is being inserted into the DOM
>> > via
>> > jQuery,
>> > so the page isn't being refreshed to trigger the ColdFusion processing.
>> >
>> > The text, coming from an AJAX function is delivered to the display
>> > function
>> > in
>> > response.QGETSTORYINFO.DATA, and is delivered from a ColdFusion
>> > component
>> > method
>> > via storyStruct.QGETSTORYINFO, so, there's not a chance, that I can see
>> > to
>> > run the
>> > replace operation on the code in the method.
>> >
>> > Can I somehow run the replace on all the qGetStoryInfo.section_text data
>> > after it's queried,
>> > then "reinsert" it into the struct, storyStruct.QGETSTORYINFO ???
>> >
>> > Suggestions?
>> >
>> > Thanks,
>> >
>> > Rick
>> >
>> > --
>> >
>> > -----------------------------------------------------------------------------------------------------------------------------------------------------------------
>> > "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
>



-- 
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.

Reply via email to