I have a popup that that opens up when a custom button is clicked. The custom button is present on a standard salesforce page. The popup has a VF page in it. There are some mandatory inputText fields on the popup that require the user to fill in information. The user can either click on 'Cancel' or 'Save' (defined as commandButtons)

My requirement is to close the popup window when the CANCEL button is clicked and redirect the user to the standard salesforce page that has the custom button to open the popup.

Also, when the user clicks on SAVE the popup should get closed after saving the details.

I do not have any standard controllers instead have custom controller on my VF page.

Any help is appreciated!

here is how my VF page looks like:

Street Name

                            <apex:pageBlockSection >
         <apex:pageblockSectionItem >
            <apex:outputlabel for="Zip">
            Zip Code
            <apex:panelGroup >
                 <div class="requiredInput">
                <div class="requiredBlock"></div>
            <apex:inputText id="Zip" value="{!Zip}" />

            <apex:commandButton value="Cancel" onclick="window.top.close();">

            <apex:commandButton value="Save" action="{!save}">


The Save action calls a controller method where I am able to save the details entered by the user. I used "window.top.close();" to close the popup when Cancel is clicked but it didn't work.

Any help?

  • Can you please update your question with some code snippets so that we can better understand your issue? – Boris Bachovski Jul 23 '14 at 7:44
  • First, if it's popup no need of redirecting to parent page. Just closing the popup it's done. This is possible and rapidly using by many developers. Post some of your try outs so that people can help you. – highfive Jul 23 '14 at 7:48
  • @highfive..Besides the default closing I need to give cancel functionality as well. – juhi Jul 23 '14 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.