InfoPath窗体事件列表说明和示例使用

InfoPath 窗体事件列表说明和示例使用

一、事件列表:

Name

Event handlers

Description

DataDOMEvent object

OnBeforeChange

OnValidate

OnAfterChange

Returns a reference to a form's underlying XML document, the return status, and other properties that contain information about the XML node during an XML Document Object Model (DOM) change. Also includes a method for raising an error.

DocActionEvent object

OnClick

Returns a reference to a form's underlying XML document, the return status, and the source XML node during a button click in the form area.

DocContextChangeEvent object

OnContextChange

Returns information about the XML Document Object Model (DOM) node that is the current context of the form's underlying XML document.

DocEvent object

OnSwitchView

OnAfterImport

Returns a reference to a form's underlying XML document during a switch view or form merge operation.

DocReturnEvent object

OnLoad

OnSubmitRequest

Returns a reference to a form's underlying XML document and the return status during the loading or submission of a form.

MergeEvent object

OnMergeRequest

Returns properties and methods that can be used during an OnMergeRequest event to programmatically interact with a form's underlying XML document and to determine merge properties such as the number of files being merged.

SaveEvent object

OnSaveRequest

Returns a number of properties and methods that can be used during a save operation from the OnSaveRequest event handler to programmatically interact with a form's underlying XML document, determine save properties, and perform the save operation.

SignEvent object

OnSign

Used to add additional data to the digital signature.

VersionUpgradeEvent object

OnVersionUpgrade

Returns a reference to a form's underlying XML document, the return status, and the document and solution version numbers during the version upgrade operation.

 

二、使用示例:

//=======

// The following function handler is created by Microsoft Office InfoPath.

// Do not modify the name of the function or the name and number of arguments.

//=======

function XDocument::OnLoad(eventObj)

{

   // Write your code here.

}

 

function msoxd__myField_attr::OnBeforeChange(eventObj)

{

   // Determine whether there is a new value.

   if (eventObj.NewValue == "")

   {

      // The value is blank, so display an error message and roll back the changes.

      eventObj.ReturnMessage = "You must supply a value for this field.";

      eventObj.ReturnStatus = false;

      return;

   }

}

你可能感兴趣的:(Path)