Cfwindow and variable
Copy link to clipboard
Copied
I found an issue using Lightwindow 2.0 and CF8, therefore I need to find a different solution. So I'm trying the cfwindow option but I am having a difficult time coding it to work the way I want.
I am displaying query resultset which shows six different values and the URL is being appended by the uniquie ID of the record.
How can I do this with cfwindow?
This is what I have so far put it's not working at all.
<a href="##" onclick="javascript:ColdFusion.Window.show('fcnews')">#Headline#</a>
This opens the window but the data is imbedded in the page and not the window.
Thanks in advance for your help.
Copy link to clipboard
Copied
Hi RockDad,
Try something like below.
As you can see I have used radio buttons, with an onClick event handler.
So when a person clicks on a radio button the value is passed to the
<cfwindow> and passed onto the source.cfm page.
Hope this helps you out some.
Leonard B
===============================
<cfform name="newslinks">
<cfinput name="newsID"
type="radio"
value="[#value_to_pass#]"
onClick="javascript:ColdFusion.Window.show('[cfwindow_name]')"
onMouseOver="style.cursor='pointer'"> #headline#
<cfinput name="newsID"
type="radio"
value="[value_to_pass#]"
onClick="javascript:ColdFusion.Window.show('[cfwindow_name]')"
onMouseOver="style.cursor='pointer'"> #headline#
</cfform>
<cfwindow
name="fcnews#NewsID#"
title=""
Width="500"
Height="400"
refreshOnShow="true"
center="true"
modal="true"
source="news_detail.cfm?NewsID={newslinks:newsID}">
</cfwindow>
Copy link to clipboard
Copied
Is it just me, or is the name of your window and the name of the window you're trying to show different from one another?
I would not have expected this sort of mismatch to cause your problem, but it certainly can't be helping.
--
Adam
Copy link to clipboard
Copied
Adam - Good catch,
I saw that last night and nothing stood out to me. You are right from what
I am seeing with the code presented, the two do not match. Guess fresh
eyes can make a difference.
I would also be surprised if a variable cannot be found error is not be
generated since when the page is loaded it would be looking for the
#variable# that is added to the <cfwindow> name attribute and at time
of load would not be available.
-- Just me thinking is all and sometimes that can be dangerous - lol.
Leonard B
Copy link to clipboard
Copied
RockDad,
If you are simply looking to generate a pop window and dynamically
display content in the popped up window, an alternative to the
<cfwindow> process could be the use of javascript and do something
like below.
Although not as fancy as the <cfwindow> process would be an
alternative for you to have for inclusion in your project.
Leonard B
= = = Code below = = =
On the page you will be linking from insert the code below into the
respective sections of the page.
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
// End -->
</script>
</head>
<body>
<a
href="[destination_page].cfm?news_id=#URLEncodedFormat(news_id)#"
onClick="NewWindow(this.href,'name','[width]','[height]','yes');return false;">[link title/name here]</a>
</body>

