XDocument.OnLoad Event
InfoPath Developer Reference |
Occurs after a Microsoft Office InfoPath 2007 form has been loaded, but before any views have been initialized.
Version Information
Version Added: InfoPath 2003
Syntax
expression.OnLoad(pEvent)
expression An expression that returns a XDocument object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
pEvent | Required | DocReturnEvent | An event object that is used during a Microsoft Office InfoPath 2007 load or submission event. |
Return Value
nothing
Remarks
This event handler allows users to cancel an operation.
If the ReturnStatus property of the DocReturnEvent object is set to False, InfoPath cancels the loading of the form. If an error occurs in the scripting code for the OnLoad event handler, InfoPath ignores it and relies on the ReturnStatus property of the DocReturnEvent object. If the ReturnStatus property is not explicitly set, the default value of True is used.
Note |
---|
When the OnLoad event occurs, the view is not initialized and the XSL Transformation (XSLT) used for the view is not yet loaded. The XDocument object is not added to the XDocuments collection until after the OnLoad event has occurred. However, the XDocument object is available during the OnLoad event. |
Example
In the following example from the Sales Report sample form, the OnLoad event handler is used to determine whether the form has been digitally signed, and if it hasn't, to initialize some date values using a combination of scripting functions and custom functions:
JScript |
---|
|
This Onload event handler example depends on two custom functions: initializeNodeValue and setNodeValue.
JScript |
---|
|
JScript |
---|
|
See Also