• #18048
    Salesforce | sushant sushant #261
    Forcetalks

    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?

    Thanks

     

    #18058
    Salesforce | Vikas Kumar Vikas Kumar #260
    Forcetalks

    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:outputPanel>
    </apex:pageBlockSectionitem>
    </apex:pageBlockSection>
    <apex:pageBlockSection >
    <apex:pageBlockSectionitem >
    <apex:commandButton value=”Get Contacts” action=”{!findContacts}”/>
    </apex:pageBlockSectionitem>

    </apex:pageBlockSection>
    </apex:pageBlock>
    <script>
    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)
    {
    newWin.focus();
    }

    return false;
    }

    function closeLookupPopup()
    {
    if (null!=newWin)
    {
    newWin.close();
    }
    }
    function fillIn(name, id)
    {
    var winMain=window.open(“https://vikas1st-dev-ed–vikasapp.ap2.visual.force.com/”+id);
    }
    </script>
    </apex:form>
    <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>
    <apex:column headerValue=”FirstName” value=”{!contact.LastName}”/>

    </apex:pageBlockTable>

    </apex:pageBlockSection>
    </apex:pageBlock>
    </apex:page>

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

Please to reply to this topic.

CONTACT US

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

Sending

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 2019 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?