+ Start a Discussion
Hari@RockzsHari@Rockzs 

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) 
Hari@RockzsHari@Rockzs

Hi friends I got solutions

 

 

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

>