Using the cfmessagebox tag

The cfmessagebox tag lets you define controls for displaying pop-up messages. In addition to the standard alert box, this tag lets you include a prompt and entry field in the box.

Using confirm dialog

The following code shows how to build a confirm message box with two buttons YES and NO.

<cfmessagebox
type="confirm"
name="msgbox1"
title="Confirm Dialog"
message="Do you want proceed?"
buttonType="YesNo"
icon="info"
labelYes="Click Yes to continue"
labelNo="No"
x=100
y=200>
<!--- This example illustrates usage of the Confirm dialog in "YesNoCancel" mode --->
<cfmessagebox
type="confirm"
name="msgbox2"
title="Save File"
message="Do you want to save the file?"
buttonType="YesNoCancel"
icon="question"
labelYes="Click Yes to save the file"
labelNo="No"
labelCancel="Quit"
width="400"
x=500
y=200>
<br><br>
<input
type="button"
name="confirm1"
onClick="javascript:ColdFusion.MessageBox.show('msgbox1');"
value="YesNo Confirm"
>
<input
type="button"
name="confirm2"
onClick="javascript:ColdFusion.MessageBox.show('msgbox2');"
value="YesNoCancel Confirm"
>

Styling a message box

The bodyStyle attribute, a CSS style specification for the body of the message box helps you to style the message. As a general rule, use this attribute to set color and font styles.
The following example illustrates the usage of the bodyStyle attribute:

<cfmessagebox
type="alert"
name="msgbox1"
title="Download Status"
message="File Download Complete"
icon="info"
width="400"
bodyStyle="background-color:white;color:blue"
x=300
y=200>
<br><br>
<input
type="button"
name="alert"
onClick="javascript:ColdFusion.MessageBox.show('msgbox1');"
value="Alert MessageBox"
>

 

 Adobe

Get help faster and easier

New user?