Skip to main content
Inspiring
December 3, 2009
Question

passing variables to a pop-up window not working

  • December 3, 2009
  • 4 replies
  • 1330 views

Hello

:

I'm trying to pass records to a popup window and I can't get it to work properly. Can anyone help me figure out what I'm doing wrong? I'm stumped!

This is my code:

the link that spawns it and the java script used for the window:

<SCRIPT LANGUAGE="JavaScript" type="text/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>

<a href="detail.cfm?ID=#ID#" onClick="NewWindow(this.href,'name','450','310','yes');return false;" class="dateNav">#place3#, #place2#</a>

here is the code for the query on the page in the pop up window:

<cfparam name="url.ID" type="integer" default="0">
<cfparam name="variables.ID" type="integer" default="#url.ID#">

<cflock timeout="2" scope="SESSION" type="READONLY">
<CFQUERY name="getBaby" datasource="#APPLICATION.dataSource#" cachedwithin="#CreateTimeSpan(0, 6, 0, 0)#">
SELECT nursery.MyImage AS place1, nursery.BFname AS place2, nursery.BLname AS place3, nursery.Blb AS place4, nursery.Bht AS place5, nursery.Date_Born AS place6, nursery.ID AS ID
FROM nursery
WHERE nursery.ID = <cfqueryparam value="#url.ID#" cfsqltype="cf_sql_integer">
</CFQUERY>
<cfset getBaby=getBaby>
</cflock>

I am obviously missing something here, but can't figure out what it is.

This topic has been closed for replies.

4 replies

pyae phyoe shein
Known Participant
December 7, 2009

I bet, cfqueryparam can't be used within  cachedwithin of cfquery.

BKBK
Community Expert
Community Expert
December 7, 2009

@Pyae Phyoe Shein

I bet, cfqueryparam can't be used within  cachedwithin of cfquery.

You're right. That. too.

pyae phyoe shein
Known Participant
December 6, 2009

How about using Val(ID) instead of cfqueryparam?

Inspiring
December 3, 2009

This:

win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus();

doesn't appear to have any url varialbles.

ilssac
Inspiring
December 3, 2009

The myPage variable is apparently populated from this.href in the function call inside the anchor tag onClick event.  So, it should, I think.

And an earlier post said that a dump of the url scope showed it populated with the expected value.

ilssac
Inspiring
December 3, 2009

What exactly is failing?

Is the window not opening?

Is it not showing the proper cfm file?

Is it not passing in the desired URL value?

The only guess I can make, since I don't know if you are showing all your code or just parts of it.  Is there a <cfoutput>...</cfoutput> block around the anchor <a ...> tag?

Inspiring
December 3, 2009

I have it surrounded by a query, I just gave you the bear bones. It has the id

in my link, but when the window opens, it doesn't bring up any records at all.

I didn't want to dump all this code on anyone. It's a lot going on in the main page where the <a> is. The main page works nice, I just can't get a record to show when you click on the link and try to pull up the full record in the pop up window. Is it the Java that's losing it?

this is the query tag:

<cfoutput query="memDB" startrow="#StartRow#" maxrows="#MaxRows#">

<a....> my link</a>

</cfoutput>

ilssac
Inspiring
December 3, 2009

Then have you dumped the url scope on your pop page to insure that it is the value you expect it to be and that this value will return a record from your database?

Putting a <cfdump var="#url#"> at the top of the popup page is always a good place to start.