• #18048
    Salesforce | sushant sushant #286

    How to call a parent window function in a child window in a salesforce VisualForce page?

    Hi All,

    How to call parent a window function in a child window in VisualForce page?



    Salesforce | Vikas Kumar Vikas Kumar #285

    Hi sushant,

    you can try something like this

    VF page

    <apex:page controller=”LookupMainController”>
    <apex:form >
    <apex:pageBlock title=”Lookup”>
    <apex:pageBlockSection columns=”1″>
    <apex:pageBlockSectionitem >
    <apex:outputLabel value=”Account”/>
    <apex:outputPanel >
    <apex:inputHidden value=”{!accountId}” id=”targetId” />
    <apex:inputText size=”40″ value=”{!accountName}” id=”targetName” onFocus=”this.blur()” disabled=”false”/> <a href=”#” onclick=”openLookupPopup(‘{!$Component.targetName}’, ‘{!$Component.targetId}’); return false”>Lookup</a>
    <apex:pageBlockSection >
    <apex:pageBlockSectionitem >
    <apex:commandButton value=”Get Contacts” action=”{!findContacts}”/>

    var newWin=null;
    function openLookupPopup(name, id)
    var url=”/apex/LookupExamplePopup?namefield=” + name + “&idfield=” + id;
    newWin=window.open(url, ‘Popup’,’height=500,width=600,left=100,top=100,resizable=no,scrollbars=yes,toolbar=no,status=no’);
    if (window.focus)

    return false;

    function closeLookupPopup()
    if (null!=newWin)
    function fillIn(name, id)
    var winMain=window.open(“https://vikas1st-dev-ed–vikasapp.ap2.visual.force.com/”+id);
    <apex:pageBlock >
    <apex:pageBlockSection >

    <apex:pageBlockTable value=”{!contacts}” var=”contact”>

    <apex:column headerValue=”LastName”>
    <apex:outputLink value=”#” onclick=”fillIn(‘{!contact.LastName}’, ‘{!contact.id}’)”>{!contact.LastName}</apex:outputLink>
    <apex:column headerValue=”FirstName” value=”{!contact.LastName}”/>



Viewing 2 posts - 1 through 2 (of 2 total)

Please to reply to this topic.

Popular Salesforce Blogs


We're not around right now. But you can send us an email and we'll get back to you, asap.


About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2020 Forcetalks. All Right Reserved.

Log in with your credentials


Forgot your details?