User Guide
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.