In the Business Server Pages forum there were several posts regarding usage of Modal Dialog in a BSP page. Still these posts remain unsolved yet. This weblog provides a possible solution for this issue.
In one of our assignments, we had a requirement of showing a popup from the main page and upon some action in the child window, processing is carried out in the main
page. Say something similar to a simple value help for an input field. Once a child window i.e. popup is opened the focus should be completely on the child window and the parent window should be disabled.
Walk through towards the solution
My trails went on with using window.open( ) to open up the child window, and set focus on the child window using onload=”window.focus()”. To my disappointment that didn’t work for me, and as usual I went for a search in the BSP forum. Initially I could find out many threads relating to this subject but the solution was still unsolved.
My only option was to use Modal Dialog to achieve this functionality. Using Modal dialog we can make the user to access the child window alone disabling the parent window.
Initially we faced many problems implementing this, but finally came up with a solution.
Working with Modal Dialog
Internet Explorer supports a few methods that enable you to apply this feature to any new window. One of which is:
The syntax for this method is:
vReturnValue = window.showModalDialog(sURL[, vArguments][, sFeatures]);
The first argument is a string that specifies the URL to load and display in the new window. The second argument, vArguments, is a variant that specifies the arguments to use when displaying the document. This parameter can be used to pass a value of any type, including an array. The dialog box can extract the values passed by the caller from the dialogArguments property of the window object.
When a new window is opened by this method, the window object of the new window (the dialog box) features the
dialogArguments</b> property, which holds the value that was assigned to the vArguments parameter of the calling method. Take a look at the following statement:
Refer to this Handling child window with parent session too.
- event handler for checking and processing user input and
- for defining navigation
DATA: tv TYPE REF TO cl_htmlb_tableview.
tv ?= cl_htmlb_manager=>get_data(
request = runtime->server->request
name = ‘tableView’
id = ‘tab01’ ).
IF tv IS NOT INITIAL.
DATA: tv_data TYPE REF TO cl_htmlb_event_tableview.
tv_data = tv->data.
IF tv_data->selectedrowindex IS NOT INITIAL.