+ Start a Discussion
deshawdeshaw 

Window.opener not supported by visualforce.

There is a pop-up window page developed in visualforce.

I want to update a field in the opener window on submitting. I am doing it through javascript using window.opener.document
It throws up an error saying window.opener doesn't exist.

How to use visualforce page as a pop-up window and access the window.opener elements?

P.S: The need is actually to update one of the element in the parent window by the value in the pop up window. (Similar to inline edit of look-up/ multi-picklist window).



dchasmandchasman
Visualforce does not have any interaction with the browser that would impact window.opener. This is purely a client side/javascript concept that should be 100% available to any javascript running in the browser. Can you post a simplified example that illustrates what you are describing?
deshawdeshaw
Here is a small example illustrating what I described in the first update.

Code:
<a href = "javascript: openIntegration
('/apex/lmPage?ic=1',
'height=290,width=520,location=no,
resizable=yes,toolbar=no,status=no,meunbar=no,
scrollbars=1',1);"><b>Choose...</b></a>

The above code opens up a new window '/apex/lmPage?ic=1'.
I have a save button in the apex page as given below:
Code:
<input type="button" value="Save" 
class="btn" name="submit" ID="submit" onclick="onSubmit()">

onSubmit function:
function onSubmit()
        {
            var ctrl = document.getElementById("j_id0:j_id2:selectedList");
            length = ctrl.options.length;
            if (length != 0) displayHdr = ctrl.options[0].value;

            window.opener.document.getElementById('leadManagers').value = 
displayHdr;
            onClose();
        }

 This gives a error at window.opener location saying "window.opener" is not accessible.

Could anyone help on this?