Errors.Add Method
InfoPath Developer Reference |
Adds an Error object to the Errors collection and returns a reference to the new Error object.
Version Information
Version Added: InfoPath 2003
Syntax
expression.Add(varNode, bstrConditionName, bstrShortErrorMessage, bstrDetailedErrorMessage, lErrorCode, bstrType)
expression An expression that returns a Errors object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
varNode | Required | Variant | The XML node that the error will be associated with. |
bstrConditionName | Required | String | The name of the error. |
bstrShortErrorMessage | Required | String | The short message for the error. |
bstrDetailedErrorMessage | Optional | String | The detailed message for the error. |
lErrorCode | Optional | Long | Default value is 0. The error code of the error. |
bstrType | Optional | String | Default value is modeless. The type of error processing. The other supported value is modal. |
Return Value
Error
Remarks
The Add method is used to create custom error messages in a Microsoft Office InfoPath 2007 form. There are two types of errors that can be created using the Add method:
- modeless: The user is notified of the error with an inline alert and can choose to return to the previous value with an undo operation.
- modal: The user is notified of the error with a dialog box alert. After clicking OK in the dialog box alert, the error will appear as an inline alert and the user can choose to return to the previous value with an undo operation.
Note |
---|
Custom errors can also be created using the ReportError method of the DataDOMEvent 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.
Example
In the following example, the Add method of the Errors collection is used to create a custom error message:
JScript |
---|
|
See Also