Whatever message this page gives is out now! Go check it out!
<cfmessagebox
bodyStyle = "CSS style specification"
buttonType = "yesno|yesnocancel"
callbackHandler = "function name"
icon = "error|info|question|warning"
labelCancel = "Cancel button label text"
labelNo = "No button label text"
labelOk = "OK button label text"
labelYes= "Yes button label text"
message = "message text"
modal = "yes|no"
multiline = "false|true"
name = "control name"
title = "title"
type = "alert|confirm|prompt"
width = "number of pixels"
x = "numeic pixel coordinate"
y = "numeic pixel coordinate"/>Attribute | Req/Opt | Default | Description |
bodyStyle | Optional | A CSS style specification for the body of the message box. As a general rule, use this attribute to set color and font styles. | |
buttonType | Optional | yesno | Applies to the control type - confirm. The buttons to display on the message box:
|
callbackhandler | Optional | The function that the control calls when a user clicks one of the buttons. For more information see Usage. | |
icon | Optional | Specifies the following CSS classes:
| |
labelCancel | Optional | Cancel | The text to put on the cancel button of a prompt message box. |
labelOk | Optional | OK | The text to put on an alert button and prompt message box OK button. |
labelNo | Optional | No | The text to put on the button used for a negative response in a confirm message box. |
labelYes | Optional | Yes | The text to put on the button used for a positive response in a confirm message box. |
message | Optional | The text to display inside the message box. | |
modal | Optional | yes | A Boolean value that specifies if the message box must be a modal window:
|
multiline | Optional | false | Valid only for prompt type message boxes. A boolean value specifying whether the prompt input text box has a single or multiple lines for text input. |
name | Required | The control name. Used to refer to the control in JavaScript. | |
title | Optional | The title for the message box. If you do not specify a title, ColdFusion assigns the control type value as the default title. | |
type | Required | The control type. Must be one of the following:
| |
width | Optional | Width of the message box in pixels. | |
x | Optional | The X (horizontal) coordinate of the upper-left corner of the message box.ColdFusion ignores this attribute if you do not set the y attribute. | |
y | Optional | The Y (vertical) coordinate of the upper-left corner of the message box.ColdFusion ignores this attribute if you do not set the x attribute. |
ColdFusion.MessageBox.show("mymessagebox");var function_name = function(button);var function_name = function(button, promptmessage);<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
//Function to to show result of a message box.
var showResult1 = function(btn,message){
alert("You entered: "+message);
}
//Function to show results of other message boxes.
var showResult2 = function(btn){
alert("You clicked button: "+btn);
}
//The button onClick handler displays the message boxes.
function showMB(mbox) {
ColdFusion.MessageBox.show(mbox);
}
</script>
</head>
<body>
<cfform>
<p>Click a button display the corresponding message box.</p>
<cfinput name="Prompt" type="button" value="Prompt"
onclick="showMB('mymessagebox01')">
<cfinput name="Prompt" type="button" value="Prompt"
onclick="showMB('mymessagebox02')">
<cfinput name="Prompt" type="button" value="Prompt"
onclick="showMB('mymessagebox03')">
</cfform>
<!--- Code to define the message boxes. --->
<cfmessagebox name="mymessagebox01" type="prompt"
message="Write a short description about yourself"
labelOK="This is OK" labelCANCEL="Cancel this"
callbackhandler="showResult1" multiline="true"/>
<cfmessagebox name="mymessagebox02" type="confirm"
message="Is it OK to save the planet?"
labelNO="Dont Save" labelYES="Sure"
callbackhandler="showResult2"/>
<cfmessagebox name="mymessagebox03" type="alert"
message="You have been ALERTED!"
callbackhandler="showResult2" />
</body>
</html>