TField OnValidate 事件

Posted jijm123

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TField OnValidate 事件相关的知识,希望对你有一定的参考价值。

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.

以上是关于TField OnValidate 事件的主要内容,如果未能解决你的问题,请参考以下文章

Delphi TField.OnValidate 可以在不引发异常的情况下恢复原始值吗?

DropdownButton 选择调用 Flutter 中其他字段的 onValidate 函数

Delphi 在dbgrideh中表格输入数据时有效性的检查(转)

tfield的字段名和显示名

java中validate()函数作用是啥?

Jquery Validation 插件 - 输入事件