DoModalPopup function
Syntax
DoModalPopup(modal_options, Cancel_button_ID, display_only, cached, Page.PAGE_NAME, title, xpos, ypos[, level, scrollpath, target_row])
In which scrollpath is:
[Record.level1_recname, level1_row, [Record.level2_recname, level2_row, ]] Record.target_recname
To prevent ambiguous references, you can also use Scroll. scrollname, in which scrollname is the same as the scroll level’s primary record name.
Description
Use DoModalPopup as the recommended function to display a secondary fluid page in a modal, secondary window with a child relationship to the parent window. This function includes a modal_options parameter, which allows you to specify characteristics of the modal window such as height and width.
Important:
Use the DoModalComponentPopup and DoModalPopup functions in fluid applications only. See Fluid User Interface Developer’s Guide: Transfer and Modal Functions for more information on which functions are available for which purposes.
Using DoModalPopup means that the user must dismiss the secondary window before continuing work in the page from which the secondary page was called. In addition, DoModalPopup can display the secondary page in a display-only mode.
Note:
Alternatively, you can specify a secondary page in a command push button definition without using PeopleCode. This may be preferable for performance reasons, especially with PeopleSoft Pure Internet Architecture.
DoModalPopup can display a single page modally. To display an entire component modally, use DoModalComponentPopup. Any variable declared as a component variable will still be defined after calling the DoModalPopup function. If you call DoModalPopup without specifying a level number or any record parameters, the function uses the current context as the parent. See Application Designer Developer’s Guide: Using Secondary Pages.
When you use the DoModalPopup function in component PreBuild or PostBuild PeopleCode event, do not use browser refresh to reload a page because the browser will throw an error.
Parameters
| Parameter | Description |
|---|---|
|
modal_options |
Specifies custom modal options as a String value. See Fluid User Interface Developer’s Guide: Modal Options for more information. |
|
Cancel_button_ID |
Specifies the ID of the cancel button as a string value. |
|
display_only |
Specifies a Boolean value indicating whether the modal secondary page is display-only. |
|
cached |
Specifies a Boolean value indicating whether to cache the <div> group container for the modal secondary page within the parent page. Note: The value of display_only must be True for this parameter to take effect. |
|
Page. PAGE_NAME |
The name of the secondary page. |
|
title |
The text that displays in the caption of the secondary page. |
|
xpos |
The pixel coordinates of the top left corner of the secondary page, offset from the top left corner of the parent page (the default of -1, -1 means centered). |
|
ypos |
The pixel coordinates of the top right corner of the secondary page, offset from the top right corner of the parent page (the default of -1, -1 means centered). |
|
level |
Specifies the level of the scroll level on the parent page that contains the row corresponding to level 0 on the secondary page. |
|
scrollpath |
A construction that specifies a scroll level in the component buffer. |
|
target_row |
The row number of the row in the parent page corresponding to the level 0 row in the secondary page. |
Returns
Returns a number that indicates how the secondary page was terminated. A secondary page can be terminated by the user clicking a built-in OK or Cancel button, or by a call to the EndModal function in a PeopleCode program. In either case, the return value of DoModal is one of the following:
-
1 if the user clicked OK in the secondary page, or if 1 was passed in the EndModal function call that terminated the secondary page.
-
0 if the user clicked Cancel in the secondary page, or if 0 was passed in the EndModal function call that terminated the secondary page.
Example
Local string &sPopupOptions = "bAutoClose@1;";
&sPopupOptions = &sPopupOptions | "bCenter@1;";
&sPopupOptions = &sPopupOptions | "bHeader@1;";
&sPopupOptions = &sPopupOptions | "bClose@1;";
&sPopupOptions = &sPopupOptions | "width@350;";
&sPopupOptions = &sPopupOptions | "height@400;";
&newHPName = "";
If DoModalPopup(&sPopupOptions, "", False, False, Page.PTNUI_ADDLP_SEC, MsgGetExplainText(95, 10017, "MNF-Add Homepage"), - 1, - 1) = 1 Then
End-If;
Restrictions on Use in PeopleCode Events
Control does not return to the line after DoModalPopup until after the user has dismissed the secondary page. This interruption of processing makes DoModalPopup a “think-time” function, which means that it shouldn’t be used in any of the following PeopleCode events:
-
SavePreChange.
-
SavePostChange.
-
Workflow.
-
RowSelect.
-
Any PeopleCode event that executes as a result of a ScrollSelect, ScrollSelectNew, RowScrollSelect, or RowScrollSelectNew function call.
-
Any PeopleCode event that executes as a result of a Rowset class Select method or SelectNew method.
-
You should not use DoModalPopup or any other think-time function in FieldChange when the field is associated with an edit box, long edit box, or drop-down list box. Use FieldEdit instead.
However, DoModalPopup can be used in FieldChange when the field is associated with a push button, radio button, check box, or hyperlink.
In addition, you can't use DoModalPopup in the SearchInit event.
Restrictions on Use With a Component Interface
This function is ignored (has no effect) when used by a PeopleCode program that’s been called by a component interface.