+ Start a Discussion

Need Help on POPUp Communication From parent Vf page to Child Vf page


HI Friends,


Scenario: I have one departments object and VF page, on Vf page i have one textbox and one button like


     Department:|_____________________| Button


When i click the button all departments will shown in popup window, and the department name ,which i was selected in that popup window will be populated into that Departmentextbox(like lookup functionality)


Thank U

Best Answer chosen by Admin (Salesforce Developers) 

Hi friends I got solutions



Child Page
<apex:page controller="GetDepartments" wizard="true">
        function sendDept(deptName)
            window.returnValue = deptName;
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!depts}" var="d">
                <apex:column headerValue="Department">
                    <a value="{!d.name}" onclick="sendDept('{!d.name}')">{!d.name}</a>
Parent popup
<apex:page id="page">
        function getchild()
            var popupstyle = "center:yes;resizable:no;dialogHeight:200px";
            getdept = window.showModalDialog('/apex/SampleLookupChild','',popupstyle);
            if(getdept != null)
                document.getElementById('page:form:pInput').value = getdept;
       /* function closepopup()
    <apex:form id="form">
        Department:<apex:inputText id="pInput"/><apex:commandButton value="LookIN" onclick="getchild()"/>
        <apex:commandButton value="close" onclick="closepopup()"/>