UI.ShowModalDialog Method
InfoPath Developer Reference |
Displays a custom modal dialog box in a Microsoft Office InfoPath 2007 form.
Version Information
Version Added: InfoPath 2003
Syntax
expression.ShowModalDialog(bstrName, varArguments, varHeight, varWidth, varTop, varLeft)
expression An expression that returns a UI object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
bstrName | Required | String | The name of the .html file used for the modal dialog box. |
varArguments | Optional | Variant | Specifies the arguments to use when displaying the modal dialog box. Can be any type of value, including an array of values. |
varHeight | Optional | Variant | Sets the height of the modal dialog box. |
varWidth | Optional | Variant | Sets the width of the modal dialog box. |
varTop | Optional | Variant | Sets the top position of the modal dialog box relative to the upper left corner of the desktop. |
varLeft | Optional | Variant | Sets the left position of the modal dialog box relative to the upper left corner of the desktop. |
Return Value
Variant
Remarks
The ShowModalDialog method of the UI object allows you to display custom dialog boxes to users as they fill out a fully trusted form. Custom dialog boxes are implemented as .html files created in any type of HTML editor. You can use scripting code in a custom dialog box that interacts with the InfoPath object model if you pass objects to the custom dialog box using the
varArguments
parameter.
To use a custom dialog box in an InfoPath form, you must first add the .html file of the custom dialog box to the form's set of resource files by using the Resource Manager dialog box. The Resource Manager dialog box is available from the Tools menu in design mode. After you have added the custom dialog box file to the form, you can use the ShowModalDialog method to display it.
Note |
---|
Although the ShowModalDialog method can only be used in fully trusted forms, you can create a custom dialog box in standard forms using the showModalDialog method of the Dynamic HTML (DHTML) object model. |
Security Level 3: Can be accessed only by fully trusted forms.
Example
In the following example, the ShowModalDialog method of the UI object is used to display a custom dialog box. Note that the XDocument object is passed to the custom dialog box using the varArguments parameter.
JScript |
---|
|
The following example is the HTML code used to implement a simple custom dialog box. Note the use of the dialogArguments property of the DHTML window object to get the values passed to the custom dialog box, which in this case is the XDocument object of the InfoPath object model, from the ShowModalDialog method. When a user clicks the Show Alert button in the custom dialog box, the source XML of the form's underlying XML document appears in a message box.
JScript |
---|
|
See Also