0

I have a piece of code which opens a popup, I enter some values and the field values need to be updated back to the parent page(visualforce page). Also I need to close the child visualforce page when I click Save and Cancel buttons. I am not able to get this working.

<button class="btn" onclick="window.open('/{!$CurrentPage.parameters.id}', target='_self');return false;">Cancel</button>
<apex:commandButton action="{!customSave}" value="Save" oncomplete="closeWin();"/><script type="text/javascript">
    function closeWin(){    
        if(window.parent){
            window.opener.location.href="/{!$CurrentPage.parameters.id}";
            window.parent.close();
        }else{
            window.opener.location.href = window.opener.location.href;
            window.close();   
        }   
    }

    function closeWindow_NoAction(){
        window.close();
    }

If required I will provide the controller code also.

1 Answer 1

0

on button use data-dismiss ex:<button class="btn" data-dismiss="classNameof PopupPage"onclick="window.open('/{!$CurrentPage.parameters.id}', target='_self');return false;">Cancel</button>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .