• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

problems passing query variable into cfwindow.

Community Beginner ,
Dec 28, 2009 Dec 28, 2009

Copy link to clipboard

Copied

Hello;

I'm writting a small custom app for a friend. I need to make a "user interface" for this project. The only thing that needs to be allowed to be updated is a new file I have set up in an admin section. The front end is more like an interface with 4 numbered links that will never change, so it is "hard coded" and not database driven.

When I click on my link to open up my cfwindow I get this error: (it also happens when I do a cfdump for url.a)

Element A is undefined in URL.

The error occurred in C:\websites\Vid1.cfm: line 9
7 : SELECT pastVid.title AS ViewField1, pastVid.MYFile AS ViewField2, pastVid.companyID
8 : FROM pastVid
9 : WHERE vidID = <cfqueryparam value="#URL.a#" cfsqltype="cf_sql_integer">
10 : </cfquery>
11 : <cfset APPLICATION.vidCli=vidCli>


I realize when dealing with a cfwindow you can't pass url variables to it normally like from page to page. How do I pass this variable? I've been running searches on the web and have come up dry on this. I also have one other question. in the pop up window, how to I create a link to just reload the pop up (cfwindow) and pull the query I'm looking for? The links I am using now, close the window and open up a full page in the place of the web site that launched the window.

Can anyone help me with this? Here is my code so far. It shouldn't have to be changed much, I'm mostly missing a variable to pull from, in place of the url.

Parent Page Code (cfwindow launch page)

<cfajaximport tags="cfwindow" />


<cfwindow
   name="myWindow"
   center="false"
   closable="true"
   draggable="true"
   height="450"
   initShow="false"
   minHeight="400"
   minWidth="430"
   refreshOnShow = "true"
   source = "Vid1.cfm"
   resizable="true"
   title="Pasture Videos"
   x="100"
   y="100"
   width="470"></cfwindow>

<cfoutput>

<a href="javascript:ColdFusion.Window.show('myWindow');ColdFusion.navigate('Vid1.cfm?a=1','myWindow');">Video 1</a>

<a href="javascript:ColdFusion.Window.show('myWindow');ColdFusion.navigate('Vid1.cfm?a=2','myWindow');">Video 2</a>

<a href="javascript:ColdFusion.Window.show('myWindow');ColdFusion.navigate('Vid1.cfm?a=3','myWindow');">Video 3</a>

<a href="javascript:ColdFusion.Window.show('myWindow');ColdFusion.navigate('Vid1.cfm?a=4','myWindow');">Video 4</a>

</cfoutput>

<cfset ajaxonload("init")>

CFWINDOW page code:

<cflock timeout="2" scope="APPLICATION" type="READONLY">
<cfquery name="vidCli" datasource="#APPLICATION.dataSource#" blockfactor="100">
SELECT pastVid.title AS ViewField1, pastVid.MYFile AS ViewField2, pastVid.companyID
FROM pastVid
WHERE vidID = <cfqueryparam value="#URL.a#" cfsqltype="cf_sql_integer">
</cfquery>
<cfset APPLICATION.vidCli=vidCli>
</cflock>

<cfoutput query="vidCli" maxrows="1">
      #ViewField1#<br />

      #ViewField2#<br />

</cfoutput>

<cfoutput>

<!--- these links are not working properly, I need to link to the cfwindow that is open and this opens a new one --->

<a href="javascript:ColdFusion.Window.show('myWindow');ColdFusion.navigate('Vid1.cfm?a=1','myWindow');">Video 1</a>

<a href="javascript:ColdFusion.Window.show('myWindow');ColdFusion.navigate('Vid1.cfm?a=2','myWindow');">Video 2</a>

<a href="javascript:ColdFusion.Window.show('myWindow');ColdFusion.navigate('Vid1.cfm?a=3','myWindow');">Video 3</a>

<a href="javascript:ColdFusion.Window.show('myWindow');ColdFusion.navigate('Vid1.cfm?a=4','myWindow');">Video 4</a>

</cfoutput>

Can anyone help me figure out how to make the owrk properly? I think I'm close

Thank you

TOPICS
Advanced techniques

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 28, 2009 Dec 28, 2009

Copy link to clipboard

Copied

Regarding:

I realize when dealing with a cfwindow you can't pass url variables to it normally like from page to page.

Why not?  The cfml reference manual for cfwindow says you can.  In fact, all the examples show url variables being passed to cfwindow.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 28, 2009 Dec 28, 2009

Copy link to clipboard

Copied

then why isn't it passing the variables for me then? I tried using url

.id I also put this in the head of the doc:

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

and did a cfdump[ right after it and got a huge java error: this was my dump:

<cfdump var="#URL.ID#">
</cfdump>
<cfabort>

if I didn't do a dump, then it loads the page, but not the db into in the output.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Dec 28, 2009 Dec 28, 2009

Copy link to clipboard

Copied

You can pass url variables to a <cfwindow...> just like any other request, but you do need to understand when they take affect.

URL variables are passed when a browser submits a request to the server.

If you are using JavaScript AJAX style functionality, the browser does not make the request.  Your JavaScript does.  If you want the variables to be passed with this request, you have to use the JavaScript mechanism to attach the url data to the request.

I hope that helps in your searching.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 28, 2009 Dec 28, 2009

Copy link to clipboard

Copied

LATEST

that's what I have going on here isn't it? Is there a way to fix my dcode or am I way off? Dan didn't answer the question... just pointed out you can pass a url. That doesn't solve the problem I'm having.

I've been working on this silly thing for days and can't get the variables passed properly. also can't get a link on the pop up page to just link in the pop up. Can you help me with this?

I thought i was close to a solution with my code? am I wrong?

thank you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation