Secondary pages are modal in that they require some sort of user intervention (e.g. clicking an
CANCEL) button before the user can go back to what they were doing.
That is, they require some form of user intervention for the user to proceed. This makes them really good for warnings and ensuring the user enters the correct data.
There are three key functions for using modal secondary pages:
DoModalto display the secondary modal page
IsModalto check if the current page is a modal page
EndModalto close a secondary modal page
You can call a secondary page as a push button/hyperlink or you can use the
DoModal PeopleCode function.
The basic syntax is:
DoModal(PAGE.pagename, title, xpos, ypos, <level, scrollpath, target_row>)
If DoModal(Page.EXAMPLE_PAGE, "Example Modal Page", - 1, - 1) = 1 Then /* Do stuff */ Else /* Exception */ End-If;
If using the Peoplecode DoModal function, you need to add a "Secondary Page Control" on the primary (i.e. calling) page, otherwise the
OK button won't return you to the primary page. You can also use a
try-catch exception block. The
ypos parameters of
-1, centre the modal secondary page.
IsModal is typically used to separate logic for modal pages from that for standard pages. The syntax is just:
IsModal(). The function returns either a true if the page is modal or a false if it isn't.
EndModal is only required if your secondary page doesn't already have its own
CANCEL buttons, which you specify in the secondary page properties.
Sometimes, the delivered
CANCEL buttons on a secondary page can misbehave and its better to put your own buttons on there and use EndModal.
The syntax for this function is:
The return value can be either
0 acts as the
CANCEL button and the
1 as the
OK button, so at the end of the PeopleCode for these buttons if you put them manually on your secondary page, put the line
EndModal(0); in the
CANCEL button PeopleCode and
EndModal(1); in the
OK button PeopleCode.