Show All

# Parent Property

A read-only property that returns a reference to the XML Document Object Model (DOM) node of the parent of the XML DOM node being changed during a data validation event.

expression.Parent

expression Required. Returns a reference to the DataDOMEvent object.

## Security Level

2: Can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

## Remarks

After you have set a reference to the XML DOM node that the Parent property returns, you can use any of the properties and methods that are supported by the XML DOM. This can be especially useful during delete operations, because the Parent property maps to the location of the XML DOM node that was removed.

Note To learn more about the XML DOM and all of the properties and methods that it supports, see the MSXML 5.0 SDK documentation in the Microsoft Script Editor (MSE) Help system.

## Example

In the following partial example from the Data Validation developer sample form, the Parent property of the DataDOMEvent object is used to check the name of the parent node; if it matches certain criteria, an error message is displayed:

    function msoxd__shippingDates::OnBeforeChange(eventObj)
    {
       var objOrderDate = new Date(XDocument.DOM.selectSingleNode
          ('/sampleData/shippingDates/orderDate')
          .text.replace(/(.*)-(.*)-(.*)/, "$2-$3-$1"));
       var objShipDate = new Date(XDocument.DOM.selectSingleNode
          ('/sampleData/shippingDates/shipDate')
          .text.replace(/(.*)-(.*)-(.*)/, "$2-$3-$1"));
       ...

       if (objShipDate.toString() != "NaN" && objOrderDate.toString() == "NaN")
       {
          eventObj.ReturnMessage = "The Ship Date is invalid without an order date.";

          if (eventObj.Parent.nodeName == "orderDate")
             eventObj.ReturnMessage += "  You must delete the Ship Date " +
                "before deleting the Order Date.";

          eventObj.ReturnStatus = false;
          return;
       }
       ...
    }

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp