Copy link to clipboard
Copied
Hello~
I am working with cfwindow for the first time, and I am running into a strange error. This is how my page is set up:
cp_html.cfm - defines a lot of functions, etc., then calls cp_html_template.cfm
cp_html_template.cfm - calls cfwindow code if a certain condition is met:
<cfif validationFlag EQ 1>
<cfajaximport tags="cfwindow, cfform">
<cfwindow
name="validFormWindow"
bodystyle="border:2px solid black; background-color:##ffffff; text-align:center;font-family:Arial;"
headerstyle="background-color:##000000; color:##ffffff; text-align:center;font-family:Arial;"
height="150"
width="300"
title="Student Validation Question"
closable="false"
draggable="false"
modal="true"
resizable="false"
initshow="true"
x="400"
y="100"
refreshonshow="true"
source="/player/cp_html_validForm.cfm" />
</cfif>
Now, the cfwindow is displaying correctly, and the source attribute is correct, but I am getting the following error inside the cfwindow:
validationQuestionQuery.time is defined on cp_html.cfm, and is used in a <cfif> statement on the source file for the cfwindow, cp_html_validForm. I started out just using a cfinclude to test all of these pages together, and when I use that tag, everything works fine and all o fthe variables are defined, so I know the value carries through to cp_html_validForm.cfm, but it is not being passed on into the cfwindow. I know this is a complicated page structure, but it's what I have to work with
Has anyone else had this problem, or know of a solution? Thank you!
KC
Copy link to clipboard
Copied
Try definining a variable called validationQuestionQuery.time within the cp_html_template.cfm see what happens.
I messed around with cfwindow several months ago and came accross similar issues with where things are defined in different templates and where the cfwindow was declared/called.
Richard
Copy link to clipboard
Copied
When one starts using AJAX functionality one needs to be very clear they understand the way the various varable scopes work and the nature of HTTP reqeust and responses.
Most of the variables used in a ColdFusion template will only exist for the duration of that one request. The process goes something like this:
1) A browser requests a page from a web server.
2) The web server receives a request and determines it should be handled by the ColdFusion application server, it passes the request to ColdFusion.
3) ColdFusion process the request building a response, nearly always using some number of variables along the way.
4) ColdFusion returns the response to the web server, discards all variables not saved in one of the few persisitant scopes and moves on to the next request in its que.
5) The web server returns the response to the browser.
6) The browser processes the received response rendering any HTML and running any JavaScript it received.
At this point, in an AJAX application, the JavaScript is capable of making new HTTP request for further information. This starts a completely new cycle starting at step one. Since HTTP is stateless by design; this request will not share any data with the previous request unless the developer has taken some steps for this to happen.
There are many ways to share data from request to request. It can be passed around in get, post or cookie HTTP headers. It can be stored on the server in server, application, or session memory, but the latter requires data passed in cookie or get headers to know which requests belong to which session states.
HTH
Ian
Message was edited by: Ian Skinner P.S. The ColdFusion AJAX features such as <cfwindow...> are just handy tools to build the JavaScript and HTML for the developer. The process is still going to follow the rules of the HTTP protocol and HTML and JavaScript standards.