Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DataDOMEvent Object

Office 2003
DataDOMEvent

An event object that is used during Microsoft Office InfoPath 2003 data validation events. 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.

Remarks

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

Note  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.

Note  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.

Using the DataDOMEvent object

In the following example from the Data Validation developer sample form, 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.

    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);
}
  

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





Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.