
156
Chapter 9 Building Dynamic Forms
Controlling cell contents
The
cfgridcolumn
type
,
value
,
valuesDisplay,
and
valuesDelimiter
attributes let
you control the data that a user can enter into a
cfgrid
cell in the following ways:
•
By default, a cell is an editable text field.
•
Use the
type
attribute to require numeric or string data, to make the fields check
boxes, or to display an image.
•
Use the
values
attribute to specify a drop-down list of values from which the user
can chose. You can use the
valuesDisplay
attribute to provide a list of items to
display that differs from the actual values that you enter in the database. You can
use the
valuesDelimiter
attribute to specify the separator between values in the
values
valuesDisplay
lists.
•
While
cfgrid
does not have a
validate
attribute, it does have an
onvalidate
attribute that lets you specify a JavaScript function to perform validation.
For more information on controlling the cell contents, see the attribute descriptions
in the CFML Reference.
How user edits are returned
ColdFusion creates the following arrays as Form variables to return edits to grid rows
and cells:
When a user selects and changes data in a row, ColdFusion creates arrays to store the
following information for rows that are updated, inserted, or deleted:
•
The original values for all columns
•
The new column values
•
The type of change
For example, the following arrays are created if you an update a
cfgrid
called
"mygrid" consisting of two displayable columns, (col1, col2) and one hidden column
(col3).
Form.mygrid.col1[
change_index
]
Form.mygrid.col2[
change_index
]
Form.mygrid.col3[
change_index
]
Form.mygrid.original.col1[
change_index
]
Form.mygrid.original.col2[
change_index
]
Form.mygrid.original.col3[
change_index
]
Form.mygrid.RowStatus.Action[
change_index
]
Array reference
Description
gridname
.
colname
[
change_index
]
Stores the new value of an edited cell.
gridname.
Original.
colname
[
change_index
]
Stores the original value of the edited grid cell.
gridname.
RowStatus.Action
[
change_index
]
Stores the edit type made to the edited grid
row: D for delete, I for insert, or U for update.
Содержание COLDFUSION 5-DEVELOPING
Страница 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Страница 58: ...38 Chapter 3 Querying a Database ...
Страница 134: ...114 Chapter 7 Updating Your Database ...
Страница 210: ...190 Chapter 10 Reusing Code ...
Страница 232: ...212 Chapter 11 Preventing and Handling Errors ...
Страница 238: ...218 Chapter 12 Using the Application Framework ...
Страница 262: ...242 Chapter 12 Using the Application Framework ...
Страница 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Страница 320: ...300 Chapter 15 Indexing and Searching Data ...
Страница 336: ...316 Chapter 16 Sending and Receiving E mail ...
Страница 374: ...354 Chapter 18 Interacting with Remote Servers ...