DataDOMEventObject Interface
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

DataDOMEventObject Interface (Microsoft.Office.Interop.InfoPath.SemiTrust)

An event object that is used during Microsoft Office InfoPath 2007 data validation events.


Namespace: Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly: Microsoft.Office.Interop.InfoPath.SemiTrust (in

public interface DataDOMEventObject : DataDOMEvent, DocActionEvent, DocReturnEvent, 

This type is a wrapper for a coclass that is required by managed code for COM interoperability. Use this type to access the members of the COM interface implemented by this coclass. For information about the COM interface, including a link to descriptions of its members, see DataDOMEvent.

The DataDOMEvent object provides a number of properties and a method that can be used within a data validation event to programmatically interact with the data that is being validated and to provide a response if the data is not valid.

The DataDOMEvent object is passed as a parameter to the OnBeforeChange, the OnValidate, and the OnAfterChange events


The OnValidate event can occur without a change in the form's underlying XML document.

The DataDOMEvent object is used to get information about the XML Document Object Model (DOM) node that is being changed, and it also provides a property for getting a reference to a form's underlying XML document. In addition, it provides properties for handling the change in data, including rejecting the change and creating an error message.


The DataDOMEvent object is passed as an argument to one of the data validation event handlers. Its properties and method are only available during the event that it is passed to.

In the following example, the DataDOMEvent object is used to check the value of the node using the Site property. If the data validation fails, the ReportError method is used to create a custom error.

[InfoPathEventHandler(MatchPath="/my:myFields/my:field1", EventType=InfoPathEventType.OnValidate)]
public void field1_OnValidate(DataDOMEvent e)
if(e.Site.text != "")
   int quantity = int.Parse(e.Site.text.ToString());
   if(quantity > 50)
      e.ReportError(e.Site, "Invalid quantity. The total number of each type of block cannot exceed 50.", false, "", 2,"modeless");
   if(quantity < 0)
      e.ReportError(e.Site, "Invalid quantity. The total number of each type of block cannot be less than 0.", false,"", 2,"modeless");
© 2016 Microsoft