# DocReturnEvent Object

DocReturnEvent

An event object that is used during a Microsoft Office InfoPath 2003 load or submission event. The DocReturnEvent object provides the XDocument property that can be used within a load or submission event to programmatically interact with the data in a form's underlying XML document. It also provides the ReturnStatus property that is used to specify whether the event is successful.

## Remarks

The DocReturnEvent object is passed as a parameter to the OnLoad and OnSubmitRequest events of an InfoPath form. The properties that it provides are available only during these events.

## Using the DocReturnEvent object

In the following example, the XDocument property of the DocReturnEvent object is used to display the source XML of a form's underlying XML document using the DOM property of the XDocument object:

    function XDocument::OnLoad(eventObj)
    {
       XDocument.UI.Alert("The source XML: " + eventObj.XDocument.DOM.xml);
       eventObj.ReturnStatus = true;
    }

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

©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