cancel
Showing results for 
Search instead for 
Did you mean: 

What is Javascript opener?

Former Member
0 Kudos

Hi, this little problem has got me in a confused state... it's partly BSP, partly Javascript - but the Javascript comes in a BSP View, so I feel it's fair to ask the question.

I have some ABAP code that calls a view (it's CL_CRM_BSP_F4_HELP method CALL_EVENT_TABLE in CRM 4.0, and the view is f4_values.bsp). The View appears as a popup window, and contains snippets of Javascript such as this:

function SubmitEvent(Event,ButtonGroupId,EventIndex)

              {

                   opener.SubmitEvent.submit(Event,ButtonGroupId,EventIndex);

                   top.close();

              }

My question is, what exactly is the "opener" object in this case? Normally another piece of Javascript in window A does something like "window.open" to open window B and that makes window A the "opener" of window B. But in this case, how can I find the "opener?" I would guess that the window.open command is created dynamically, so it is next to impossible to search for it.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member181879
Active Contributor
0 Kudos

Hallo Paul,

"opener" is standard JavaScript. Which means that if you ask your favourite search engine for "Javascript opener", you will get 64400 hits in 0,34 seconds. This thing is fast.

"opener" is effectively the window object that opened the new window. You can for example do things such as opener.document.getElementById("myField").value = "new value". This is typically used in cases where F4 helps runs in popup window, and must pass a value back to main window.

What that JavaScript above does, is to call a Javascript function in the original window (which by accident submits the form, so that the display will be refreshed), and then it closes itself (the popup window).

Question is completely Javascript. The fact that a string of characters stands on a BSP page/view (and you happen to recognize them as JavaScript), does not mean that BSP recognizes the characters as anything more than a string of characters.

Fair to ask. One day you can answer another question in this forum. Feel it's fair to ask.

bye, brian