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

POP UP THE EMPLOYEENAMES AND SELECTING EMPLOYEES FROM EMPLOYEE POPUP

Hi


Scenario:


       I have Department & Employee Objects.I have VF page On that i have one picklist of Departments ,one button and One Textbox for Employee.When i select the department in the picklist ,Employees who belongs to that department are displayed in popup,and i have to select the Employeename from the popuplist,the selected Employeename only populated into Employee textbox.



Thank u

Best Answer chosen by Admin (Salesforce Developers) 
Hari@RockzsHari@Rockzs

 

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>