
840
DEVELOPING
COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
Las
t
upda
te
d 8/5/2010
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<!--- Display the text if the form has been submitted with text. --->
<cfif isdefined("form.text01") AND (form.text01 NEQ "")>
<cfoutput>#form.text01#</cfoutput><br />
</cfif>
<!--- A form with a basic rich text editor and a submit button. --->
<cfform name="form01" >
<cftextarea richtext=true name="text01" />
<cfinput type="submit" value="Enter" name="submit01"/>
</cfform>
</body>
</html>
Note:
If you use the rich text editor in your pages, you cannot configure your web server to have ColdFusion process files
with the .html or .htm extensions. The default HTML processor must handle pages with these extensions.
Configuring the rich text editor
You can customize the rich text editor in many ways. The
cftextarea
attributes support some basic customization
techniques. For more detailed information, see the
FCKEditor website
at http://wiki.fckeditor.net/.
Defining custom toolbars
You can use the following techniques to control the appearance of the toolbar:
•
Specify the toolbar name in the
toolbar
attribute
•
Create custom toolbars in the fckconfig.js file.
The editor has a single toolbar consisting of a set of active icons and fields, and separators. The
toolbar
attribute lets
you select the toolbar configuration. The attribute value specifies the name of a toolbar set, which you define in a
FCKConfig.ToolbarSets entry in the
cf_webRoot
/CFIDE/scripts/ajax/FCKEditor/fckconfig.js file.
The rich text editor comes configured with two toolbar sets: the Default set, which contains all supported editing
controls, and a minimal Basic set. By default, the editor uses the Default set. To create a custom toolbar named
BasicText with only text-editing controls, create the following entry in the fckconfig.js file, and specify
toolbar="BasicText
" in the
textarea
tag.
FCKConfig.ToolbarSets["BasicText"] = [
['Source','DocProps','-','NewPage','Preview'],
['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Bold','Italic','Underline'],
['Outdent','Indent'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
'/',
['Style','FontFormat','FontName','FontSize'],
['TextColor','BGColor'],
['FitWindow','-','About']
];
This configuration defines a toolbar with two rows that contain a subset of the full tool set designed to support basic
text editing.