Skip to content

ValidateRow - cCJGrid

Validates all items in the SelectedRow

Type: Function
Return Data Type: Handle

Parameters

Parameter Type Description
bTakeFocus Boolean If true, the column focus will be moved to the column that failed validation

Syntax

Function ValidateRow Boolean bTakeFocus Returns Handle

Call Example

Get ValidateRow bTakeFocus to HandleVariable

Description

ValidateRow validates all columns in the SelectedRow. It does this by sending ValidateSelectedRow to the datasource object. ValidateSelectedRow sends the private message Validating to each column object, which sends the OnValidating event, which will return True if validation fails.

With non-data aware grids (cCJGrid), OnValidating is used to test if each column is valid. As soon as the first invalid column is encountered, the validation process is halted and the object handle of the column object is returned. If bTakeFocus is true, the grid's column focus will be moved to the invalid column.

With data-aware grids (cDbCJGrid), the validation process is more sophisticated. While OnValidating can be used to test for an invalid column, the cDbCJGridColumn object also performs a data dictionary validation for the column and that is where your validation code will most likely reside. In addition, this data dictionary validation is applied to every table column in your data dictionary and not just the table columns that are bound to grid columns. If a validation error occurs in a table column that is not associated with a grid column, ValidateRow returns -1, as opposed to a column object handle.

This message is sent by SaveSelectedRow as part of the row save process.

Return Value

Returns zero if all columns are valid. If column data triggers a validation error, it returns the object handle of the column that failed validation. If the row is not valid, but the error was not associated with a specific column object, -1 is returned.