The bind attribute lets you set the value of the fields using the contents of other form fields. You can use the bind attribute with the cftextarea tag and any cfinput type that takes a value, including hidden. This data binding occurs dynamically as the user enters data within Flash on the client system. Flash does not send any information to ColdFusion until the user submits the form. To use the bind attribute to specify the field value, use the following formats:
| Data source | bind attribute format |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note: If you use the bind attribute, you cannot use the value attribute.
The following rules and techniques apply to the binding formats:
value with display to get the displayed value, or with path to get the path to the node in the tree.
cfselect item by replacing data with label.
cfselect control, the selectedItem object contains the most recent selection, and a selectedItems array contains all selected items. You can access the individual values in the array, as in myTree.selectedItems[1].data. The selectedItems array exists only if the user selects multiple items; otherwise, it is undefined.
The following example shows how to use the values from the firstName and lastName fields to construct an e-mail address. The user can change or replace this value with a typed entry.
<cfformgroup type="horizontal" label="Your Name">
<cfinput type="text" required="Yes" name="firstName" label="First"
value="" width="100"/>
<cfinput type="text" required="Yes" name="lastName" label="Last"
value="" width="100"/>
</cfformgroup>
<cfinput type="text" name="email" label="email"
bind="{firstName.text}.{lastName.text}@mm.com">