User Guide

Table Of Contents
648 Chapter 27: Building Dynamic Forms with cfform Tags
Controlling cell contents
You can control the data that a user can enter into a
cfgrid cell in the following ways:
By default, a cell is not editable. Use the cfgrid attribute selectmode="edit" to edit cell
contents.
Use the cfgridcolumn type attribute to control sorting order, to make the fields check boxes,
or to display an image.
Use the cfgridcolumn values attribute to specify a drop-down list of values from which the
user can choose. 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.
Although the cfgrid tag 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 for the
cfgridcolumn tag in CFML Reference.
How user edits are returned
When a user inserts or deletes a row in a grid or changes any cells in a row and submits the grid,
ColdFusion creates the following arrays as Form variables:
Note: The periods in these names are not structure separators; they are part of the text of the array
name.
ColdFusion creates a gridname.colname array and a gridname.Original.colname array for each
column in the grid. For each inserted, deleted, or changed row in the grid, ColdFusion creates a
row in each of these arrays.
For example, the following arrays are created if you update a
cfgrid tag called mygrid that
consists of two displayable columns (col1, col2) and one hidden column (col3):
Form.mygrid.col1
Form.mygrid.col2
Form.mygrid.col3
Form.mygrid.original.col1
Form.mygrid.original.col2
Form.mygrid.original.col3
Form.mygrid.RowStatus.Action
Array name Description
gridname.colname Stores the new values of inserted, deleted, or updated cells.
(Entries for deleted cells contain empty strings.)
gridname.Original.colname Stores the original values of inserted, deleted, or updated
cells.
gridname.RowStatus.Action Stores the type of change made to the grid rows: D for
delete, I for insert, or U for update.