Adobe COLDFUSION 9 Manual page 785

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
automatically. You can replace the text.</font></textformat>
</cfformitem>
<cfinput type="text" name="email" label="email"
bind="{firstName.text}.{lastName.text}@mm.com">
<cfformitem type="hrule" style="color:##999900; shadowColor:##DDDD66;
strokeWidth:4"/>
<cfinput type="text" name="phone" validate="telephone" label="Phone">
<!--- Styles control the colors of the current, selected, and
rolled-over dates. --->
<cfinput type="datefield" name="mydate1" label="Date"
style="rollOverColor:##DDDDFF; selectionColor:##0000FF;
todayColor:##AAAAFF">
</cfformgroup> <!--- vbox --->
</cfformgroup> <!--- panel --->
<!--- A style centers the buttons at the bottom of the form. --->
<cfformgroup type="horizontal"style="horizontalAlign:center">
<cfinput type = "submit" name="submit" width="100" value = "Show Results">
<cfinput type = "reset" name="reset" width="100" value = "Reset Fields">
</cfformgroup>
</cfform>
Using ActionScript in Flash forms
ActionScript 2.0 is a powerful scripting language that is used in Flash and other related products and is like JavaScript.
You can use a subset of ActionScript 2.0 code in your Flash forms.
Information on how to include ActionScript in your Flash forms, and restrictions and additions to ActionScript that
apply to ColdFusion Flash forms are described here. However, information on writing ActionScript is not provided.
For details on ActionScript and how you can use it, see the Flash ActionScript 2.0 documentation, including the
documents available in the Flash and Flex sections of LiveDocs at www.adobe.com/go/learn_cfu_docs_en.
Using ActionScript code in CFML
You can use ActionScript in the following attribute of tags in CFML Flash format forms:
• Form and control events, such as the
attributes of the
cfinput
event attributes.
• Bind expressions, which you can use to set field values. For more information on binding data, see
in Flash
forms" on page 776.
Your ActionScript code can be inline in the form attribute specification, you can make a call to a custom function
that you define, or you can use the ActionScript
ActionScript from a .as file.
The following example shows a simple Fahrenheit to Celsius converter that does the conversion directly on the
client, without requiring the user to submit a form to the ColdFusion server.
<cfform format="flash" width="200" height="150">
<cfinput type="text" name="fahrenheit" label="Fahrenheit" width="100"
value="68">
<cfinput type="text" name="celsius" label="Celsius" width="100">
<cfinput type="button" name="convert" value="Convert" width="100"
onClick="celsius.text = Math.round((farenheit.text-32)/1.8*10)/10">
</cfform>
attribute of the
onSubmit
tag. The attribute description on the tag reference pages in the CFML Reference list the
include
Last updated 8/5/2010
tag, or the
cfform
onChange
command in the attribute specification to get the
780
and
onClick
"Binding data

Advertisement

Table of Contents
loading

Table of Contents