+ Start a Discussion
Arshad ShaikArshad Shaik 

How to make a VFPage as a popup

Hi All,

Can anyone help me out how to create a VFPage as a popup?

Right now, I know that VFPage which I have created is opening up in a new window.
Instead, it should open as a popup.

Thanks in advance!!
And how do you call your visual force page? from an other page or from a custom button on a standard page?

if it is a custom button you can use the standard way of creating a popup (on custom button detail you can click on window open properties)Window open properties on custom button
Deepak Kumar ShyoranDeepak Kumar Shyoran
You can use following code to open a popuop;

function popupwindow(url, title, w, h) {
    wLeft = window.screenLeft ? window.screenLeft : window.screenX;
    wTop = window.screenTop ? window.screenTop : window.screenY;

    var left = wLeft + (window.innerWidth / 2) - (w / 2);
    var top = wTop + (window.innerHeight / 2) - (h / 2);
    return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);

<apex:commandButton value="Popup" onclick="popupwindow('http://www.google.com/', 'hello', 400, 400);" />

Arshad ShaikArshad Shaik
I won't be calling from custom button or link either.

I call it when user clicks on Hyerlink image formula text field.
As soon as the user clicks on that image then popup window should open up.
Deepak Kumar ShyoranDeepak Kumar Shyoran
If this is on your V.F page then all you have to do is to call above javascript function from onclik event of your image input field or other apex tag which you are using to display that image and link.
Arshad ShaikArshad Shaik
Hi Deepak,

Thanks for the inputs.

That image formula text field will be on detail page of a custom object record. That image formula text field is NOT on VF Page.

When user clicks on that image then a VF page should open as a popup but not in new window. 
Deepak Kumar ShyoranDeepak Kumar Shyoran
Sorry but this is not possible on Details page as there is not such option with HYPERLINK function to open a popup on detial page.
Ravi NarayananRavi Narayanan
Use VisualStrap bootstrap and you can use something called Modal there