function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
uzairuzair 

How to create a popup window based on onclick event.

Hi all,

 

I have created two pages, by name 'A' and 'B'.

 

What I require is, if I click 'Click here for B' link from the page 'A' the popup window should appear and display the page 'B' after filling the details in page 'B' when i click 'Ok' button of the page 'B', the page 'B' should disappear and the page 'A' should be continued.

 

Any help regarding this will be highly appreciated.

 

Note that I want to do this with out using java script.

 

Thanks in Advance.

Best Answer chosen by Admin (Salesforce Developers) 
SSRS2SSRS2

To do onClick event have to use JS

function for open page B as popup window

 

 function popupB() {
    newwindow=window.open('B','myWindow','height=200,width=150');
    if (window.focus) {newwindow.focus()}
    return false;
 }

 

function for close window(add page B's OK button)

 

onClick="window.close()"

-Suresh

All Answers

SSRS2SSRS2

To do onClick event have to use JS

function for open page B as popup window

 

 function popupB() {
    newwindow=window.open('B','myWindow','height=200,width=150');
    if (window.focus) {newwindow.focus()}
    return false;
 }

 

function for close window(add page B's OK button)

 

onClick="window.close()"

-Suresh

This was selected as the best answer
Imran MohammedImran Mohammed

 Use 

<apex:outputLink value="#" onclick="window.open('URL FOR Visualforce page','mainWin',width=500,height=710');">Click here for B</apex:outputLink>

 

And for closing window in page B,

<apex:commandButton value="Ok" onclick = "window.close();"/>

Pradeep_NavatarPradeep_Navatar

Tryout the sample code given below :

 

            <script>

            function popup(oid)

                                                {

                                                    var url='/apex/ma4?id=' + oid;  

                                                    window.open(url,"Homepage","resizable=yes,status=yes,scrollbars=yes,width=400,height=200,target=_blank");

                                                }

                                                </script>

            <apex:column ><apex:commandlink/>

                  <apex:facet>Browse</apex:facet>

            </apex:column>

                                                in Another visual force page(ma4)

                                                <script>

                                                function closeWindow()

                                                {

                                                                if({!propSuccess})

                                                                {

                                                                                window.parent.parent.opener.document.getElementById('xyz').onclick();

                                                                                window.parent.close();

                                                                }

                                                }

           window.onload = closeWindow;

           </script>

 

Hope this helps.