Strange string thing happening.

View: New views
3 Messages — Rating Filter:   Alert me  

Strange string thing happening.

by Kevin Huff-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hey guys. I have something kinda funky happening to me. I'm generating the code for some stuff and I'm making a link to a cfwindow. But when the page is made the link for the window is all sorts of messed up. I'm sure it has to do with escaping the single quotes but I've tried a bunch of different variations and none have worked. Idas?

This code:
        <cfset noteCell = "<div class='noteCell'><span class='noteInfo'>#getNotes.user#    #getNotes.timeStamp#     <a href='javascript:ColdFusion.Window.show(''ReplyToNote#getNotes.id#'')'>Reply</a></span></div>">

Generates this link:
<div class="noteCell">
<span class="noteInfo">
cameron    10/21/09 11:23 AM  
<a )="" replytonote26="" href="javascript:ColdFusion.Window.show(">Reply</a>
</span>
<br/>
</div>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4853
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.15

Re: Strange string thing happening.

by Jerry Johnson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


If you look at your cfset, you encase the content in double quotes.

But inside that string, the javascript show function param is also encased
in double quotes.

You need to escape those inner double quotes. You can do this by making 2 in
a row. ""


...Window.show(""ReplyToNote#getNotes.id#"")'>...


...I think. I admit to being a little CF rusty lately.

=)

Jerry Johnson


On Thu, Oct 22, 2009 at 3:45 AM, Kevin Huff <khuff@...>wrote:

>
> Hey guys. I have something kinda funky happening to me. I'm generating the
> code for some stuff and I'm making a link to a cfwindow. But when the page
> is made the link for the window is all sorts of messed up. I'm sure it has
> to do with escaping the single quotes but I've tried a bunch of different
> variations and none have worked. Idas?
>
> This code:
>        <cfset noteCell = "<div class='noteCell'><span
> class='noteInfo'>#getNotes.user#    #getNotes.timeStamp#
>     <a
> href='javascript:ColdFusion.Window.show(''ReplyToNote#getNotes.id#'')'>Reply</a></span></div>">
>
> Generates this link:
> <div class="noteCell">
> <span class="noteInfo">
> cameron    10/21/09 11:23 AM
> <a )="" replytonote26=""
> href="javascript:ColdFusion.Window.show(">Reply</a>
> </span>
> <br/>
> </div>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4854
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.15

Re: Strange string thing happening.

by Kevin Huff-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>You need to escape those inner double quotes. You can do this by making 2 in
>a row. ""

It is actually encased in double single quotes. I guess that was my problem. I thought I needed it to be single quotes around the window name. I guess not. Thanks a lot Jerry.

Kevin.




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4855
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.15