System field validation functions must be integer functions returning TRUE if the string in the field is valid and FALSE if it is not valid. Additionally, if the string in the field is invalid, you should set VAL_ERR appropriately so that the form editor can display a validation error message.
Field validation functions must accept four parameters: a pointer to a string, a pointer to a picture string, a pointer to a field structure, and a pointer to a conversion buffer.
The complete call for a field validation function is as follows:
|
||
|
|
|
|
|
|
|
|
|
|
|
|
The first parameter will point to a string which contains an exact copy of the field contents (including protected characters). The dfldp parameter will contain the field pointer for the field to be converted. The system passes a conversion buffer so you do not have to allocate memory in your function. The conversion buffer is of the size specified in the field type structure for the field type.
The strings containing the field contents and picture strings must not be changed.
The checks, comparisons, and tests you build into the function will depend on the purpose of your field type. A new system validation function may call existing system validation functions.