XDocument.SetDirty Method

InfoPath Developer Reference

Sets the**IsDirty** property on the XDocument object to a Boolean value that indicates whether the data in a Microsoft Office InfoPath 2007 form has been modified since it was last saved.

Version Information
 Version Added:  InfoPath 2003

Syntax

expression.SetDirty(vfIsDirty)

expression   An expression that returns a XDocument object.

Parameters

Name Required/Optional Data Type Description
vfIsDirty Required Boolean Specifies whether the form is to be marked as unmodified or not.

Return Value
Nothing

Remarks

The SetDirty method can be used from the OnSubmitRequest event handler to force a document to be marked as unchanged. InfoPath will therefore not request the user to save the form when it is closed.

The SetDirty method can also be used from the OnSaveRequest event handler to programmatically mark the form as changed or unchanged since it was last saved.

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.

Example

In the following example, the IsDirty property of the current form is set to False so that InfoPath will not prompt the user to save the form when it is closed.

JScript
  XDocument.SetDirty(false);

See Also