|InfoPath Developer Reference|
Version Added: InfoPath 2003
expression An expression that returns a DataDOM object.
|pDataDOMEvent||Required||DataDOMEvent||An event object that is used during Microsoft Office InfoPath 2007 data validation events.|
This event handler does not allow users to cancel an operation.
During the OnValidate event, the form's underlying XML document is placed in read-only mode.
The OnValidate event is typically used for handling errors and working with the Errors collection—for example, adding new errors or deleting existing ones.
|In some cases, events related to changes in a form's underlying XML document may occur more than once. For example, when existing data is changed, an insert and delete operation occurs.|
In the following partial example, the OnValidate event handler is used to validate contact information. If the data is invalid, the ReportError method of the DataDOMEVent object is used to create an error.