+ Start a Discussion
SandrineSandrine 

Custom button to popup a VF page

Hello,

I have a custom button like below.
I want to open the Vf inside a popup or new window, how can i achieve it.
User-added image

Thanks
Best Answer chosen by Sandrine
Krishna SambarajuKrishna Sambaraju
Hello Sandrine,

To open a VF page in a popup you need to select the Behaviour for the button as "Execute Javascript" and add the javascript in the text area as below.

window.open('/apex/test','mypopup','top=150,left=200,location=1,status=1,scrollbars=1, width=500,height=600'); 

Hope this helps.

All Answers

Shashikant SharmaShashikant Sharma
Make your VFP to use Standard Controller the object where you are using this popup. like if it is account then 
 
<apex:page StandardController="Account" >
Chose content source as VFP and select the page you want to open in popup.

Otherwise you could chose Execute Java Script and use Window.open( java script method to open it in popup.

Thanks
Shashikant
SandrineSandrine
If i change, anything from aobe, i dont see the custom button to add on a layout.
Is there a tutorial where it uses List button and visualforce page.

I dont use standard object, it is can be contoller="cuntom__c"
Krishna SambarajuKrishna Sambaraju
Hello Sandrine,

To open a VF page in a popup you need to select the Behaviour for the button as "Execute Javascript" and add the javascript in the text area as below.

window.open('/apex/test','mypopup','top=150,left=200,location=1,status=1,scrollbars=1, width=500,height=600'); 

Hope this helps.
This was selected as the best answer