Data.DB.TField.OnValidate
Delphi
property OnValidate: TFieldNotifyEvent read FOnValidate write FOnValidate;
C++
__property TFieldNotifyEvent OnValidate = {read=FOnValidate, write=FOnValidate};
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
event | published | Data.DB.pas Data.DB.hpp |
Data.DB | TField |
Description
Occurs just before the data is written to the record buffer.
Write an OnValidate event handler to validate changes made to the data in the field, just before the data is written to the current record buffer. The EditMask property allows validation of the data on a character by character basis while it is being entered by the user. OnValidate allows an application to validate the data as a whole.
When the value of a field component is assigned programmatically, validation by the EditMask is bypassed, since there is no data-aware control to enforce adherence to the mask. OnValidate allows an application to validate such data before it is posted to the database table.
To reject the current value of the field from the OnValidate event handler, raise an exception.
When writing the value of a field to the current record buffer, the following steps occur:
1. The OnValidate event handler is called to validate the data.
2. If the OnValidate event handler does not raise an exception, the data is written to the current record buffer.
3. If writing the data does not raise an exception, the OnChange event handler is called to allow a response to the change.
OnValidate is an event handler of type Data.DB.TFieldNotifyEvent.