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:
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. |
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
The value of the array index increments for each row that is added, deleted, or changed, and does not indicate a grid row number. All rows for a particular change have the same index in all arrays. Unchanged rows do not have entries in the arrays.
If the user makes a change to a single cell in col2, the following array elements contain the edit operation, the edited cell value, and the original cell value:
Form.mygrid.RowStatus.Action[1] Form.mygrid.col2[1] Form.mygrid.original.col2[1]
If the user changes the values of the cells in col1 and col3 in one row and the cell in col2 in another row, the information about the original and changed values is in the following array entries:
Form.mygrid.RowStatus.Action[1] Form.mygrid.col1[1] Form.mygrid.original.col1[1] Form.mygrid.col3[1] Form.mygrid.original.col3[1] Form.mygrid.RowStatus.Action[2] Form.mygrid.col2[2] Form.mygrid.original.col2[2]
The remaining cells in the arrays (for example, Form.mygrid.col2[1] and Form.mygrid.original.col2[1]) have the original, unchanged values.