Name of function to call before every field is processed for new records Default: This function should have 3 parameters. $colname is the field name, &$data is the data and $type is the ADODB data type (not the native type).
For $data, dates are passed as strings in 'Y-m-d h:i:s' format, eg. 4pm 23rd February 2002 is '2002-02-23 16:00:00'. Strings are passed without quoting. Do not quote strings yourself because phpLens does it for you.
For $type, legal values are X (long text), B (blob/image), D (date), T (timestamp), C (char), N (numeric), I (integer). See ADODB readme.htm documentation.
Return a value of
-2 to cancel the insert, show the New Record form, and clear all fields
-1 to skip this field when inserting,
0 to cancel the insert, show the New Record form, leaving all fields unchanged
1 to continue inserting.
There is no eventPostInsertField property.
Example
//I want to cancel the insert if one
//specific column has one specific value...
$lens->eventPreInsertField = 'CheckField';
// return -1 = skip processing this field
// return 0 = cancel INSERT sql
// return 1 = process this field and continue INSERT sql
function CheckField($colname, $data, $type)
{
// $colname is uppercase
if ($colname == 'FIELDTOCANCEL' and $data == 'datatocancel')
return 0; // cancel
return 1; // normal
}
Basic:Yes Advanced/Enterprise:Yes DynamicEdit:Yes [Version 1.0]
|