# IsDirty Property

A read-only property that returns a Boolean value that indicates whether the data in a Microsoft Office InfoPath 2003 form has been modified since it was last saved.

expression.IsDirty

expression Required. An expression that returns a reference to an XDocument 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

If the IsDirty property is True, data in the form's underlying XML document has been changed since it was last saved. If False, no changes have occurred.

Note Changes that occur during the OnLoad event will not result in the IsDirty property being set to True.

## Example

In the following example, the IsDirty property of the XDocument object is used to determine whether data in the form has been changed:

    if (XDocument.IsDirty)
       XDocument.UI.Alert("Data has been changed.");
    else
       XDocument.UI.Alert("Data has not been changed.");

©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