DataDOMEvent Object

InfoPath Developer Reference

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

Version Information
 Version Added:  InfoPath 2003

Remarks

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, OnValidate, and OnAfterChange events.

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.

Bb229845.vs_note(en-us,office.12).gif  Notes
  • The OnValidate event can occur without a change in the form's underlying XML document.
  • 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.

For more information about using the DataDOMEvent object, see Responding to form events.

Example

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.

JScript
  function msoxd__itemB_quantityListB::OnValidate(eventObj)
{
   if (parseInt(eventObj.Site.nodeTypedValue, 10) > 50)
      eventObj.ReportError(eventObj.Site, "Invalid quantity.  " +
         "The total number of each type of block cannot exceed 50.", false);

if (parseInt(eventObj.Site.nodeTypedValue, 10) < 0) eventObj.ReportError(eventObj.Site, "Invalid quantity. " + "The total number of each type of block cannot be less than 0.", false); }

See Also