Creates a ColdFusion pop-up window. This function is equivalent to the cfwindow tag.
ColdFusion.Window.create(name
,title
,URL
[,configuration
])
cfwindow, ColdFusion.Window.getWindowObject, ColdFusion.Window.hide, ColdFusion.Window.onHide, ColdFusion.Window.onShow, ColdFusion.Window.show, ColdFusion.Tree.getTreeObject, "Using pop-up windows" in the ColdFusion Developer's Guide
ColdFusion 8: Added this function
Parameter |
Description |
---|---|
name |
The name of the window. This attribute is required to interact with the window, including to dynamically show or hide it. If a window with the specified name already exists, the function will show that window, and will ignore the remaining parameters; otherwise, the name must be unique on the page. |
title |
The text to display on the window title bar. You can use HTML mark-up to control the title appearance. |
URL |
The URL from which to get the window body contents. This attribute can use URL parameters to pass data to the page. ColdFusion uses standard page path resolution rules to locate the page. Note: If the page specified in this attribute contains tags that use ColdFusion AJAX features, such as the cfform, cfgrid, and cfpod tags, you must identify the tags in a cfajaximport tag on the page that includes this function. For more information, see cfajaximport. |
configuration |
An object containing window configuration parameters. For details, see "Usage". |
This function does not return a value.
This function is equivalent to the cfwindow tag.
If you do not also use a cfwindow tag on a page that calls this function, you must specify a cfajaximport tag on the page and specify cfwindow in the tags attribute. Doing so ensures that the page includes the necessary JavaScript to create the window. For example, use the following line if you do not have to import the JavaScript for any other ColdFusion AJAX features.:
<cfajaximport tags="cfwindow">
The configuration parameter defines the window characteristics; it can have any or all of the following entries:
Entry |
Default |
Description |
---|---|---|
callbackhandler |
|
A function that is called when the window body loads. This function must not take any arguments. |
center |
false |
A Boolean value that specifies whether to center the window over the browser window.
|
closable |
true |
A Boolean value that specifies whether the user can close the window. If true, the window has an X close icon. |
draggable |
true |
A Boolean value that specifies whether the user can drag the window. To drag the window, click the mouse on the title bar and hold the button down while dragging. If the window does not have a title, users cannot drag it. |
errorhandler |
|
A function that is called if an error occurs in loading the window body. This function must take two arguments:
|
height |
300 |
Height of the window in pixels. If you specify a value greater than the available space, the window occupies the available space and the resize handles do not appear. |
initshow |
false |
A Boolean value that specifies whether to display the window when the containing page first displays. If this value is false, use the ColdFusion.Window.show JavaScript function to display the window. |
minheight |
0 |
The minimum height, in pixels, to which users can resize the window. |
minwidth |
0 |
The minimum width, in pixels, to which users can resize the window. |
modal |
false |
A Boolean value that specifies whether the window is modal, that is, whether the user can interact with the main window while this window is displaying. If true, the user cannot interact with the main window. |
resizable |
true |
A Boolean value that specifies whether the user can resize the window. |
width |
500 |
Width of the window in pixels. If you specify a value greater than the available space, the window occupies the available space and the resize handles do not appear. |
x |
|
The X (horizontal) coordinate of the upper-left corner of the window, relative to the browser window. ColdFusion ignores this attribute if the center attribute value is true, and if you do not set the y attribute value. |
y |
|
The Y (vertical) coordinate of the upper-left corner of the window, relative to the browser window. ColdFusion ignores this attribute if the center attribute value is true, and if you do not set the x attribute value. |
The following minimal CFML application creates a window and gets the window contents from the hello1.cfm file.
<cfajaximport tags="cfwindow"> <cfform name="test"> <cfinput type="button" name="x" value="Create Window" onClick="ColdFusion.Window.create('Window1', 'This is a CF window', 'http://localhost:8500/My_stuff/AjaxUI/Book/hello1.cfm', {x:100,y:100,height:300,width:400,modal:false,closable:false, draggable:true,resizable:true,center:true,initshow:true, minheight:200,minwidth:200 })"> </cfform>
The hello1.cfm file can be as simple as the following line:
Hello from hello1.cfm