VF for popup: RELLegalNameChangePopup ", "answerCount": 16, "upvoteCount": 0, "datePublished": "2018-06-05T19:13:28.000Z", "author": { "@type": "Person", "name": "Varsha Reddy", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000CBSNTQA5", "affiliation": { "@type": "Organization", "name": "HCSC" } }, "acceptedAnswer": { "@type": "Answer", "text": "Hi DeepV, Please refer the code below which will open a popup with a parameter from the parent page. Controller (acctControllPopup)-   public with sharing class acctControllPopup { public string accountName{get;set;} public string namePara{get;set;} Public string namePp; public string nameAcct; public acctControllPopup(ApexPages.StandardController controller) { displaySection=true; nameAcct= ApexPages.currentPage().getParameters().get('namePp'); nameAcct= '%'+nameAcct+'%'; system.debug('nameAcct '+nameAcct); aAccount = [Select Id,Name from Account where name like :nameAcct]; } public List aAccount{get;set;} public boolean displaySection{get;set;} public pageReference step2(){ return null; } public pageReference reset(){ return null; } public pageReference setPara(){ //pageReference pageRef = new pageReference('/apex/popQuestionPagewhichWillOpen'); //pageRef.getParameters().put('namePp', namePara); return null; } } Its a very basic one but it will probably get your job Done. I hope it helps.", "upvoteCount": 1, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T4V0sSAF", "datePublished": "2018-06-05T21:10:48.000Z", "author": { "@type": "Person", "name": "Komal Dwivedi", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000DfbXDQAZ", "affiliation": { "@type": "Organization", "name": "ANZ" } } }, "suggestedAnswer": [ { "@type": "Answer", "text": "Hi Kd Komal, this is what i have in the controller: public Account aAccount { get; set; }  public String aAccountID { get; set; } //inside the constructor  ID aAccountID = [Select AccountID from Contact where id = :contactid].AccountId; aAccount = [select id, name from account where id = :aAccountID];  ", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T4V0sSAF", "datePublished": "2018-06-05T19:47:29.000Z", "author": { "@type": "Person", "name": "Varsha Reddy", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000CBSNTQA5", "affiliation": { "@type": "Organization", "name": "HCSC" } } } ] } }
Skip to main content
When I click the edit button, the popup displays but does not display any data. Please help!

What is the mistake I'm doing it here.

what I have tried so far:

Visual Force:

<apex:page standardcontroller="UCF_REL__c" extensions="UCFController" sidebar="false" > 

<apex:sectionheader title="UCF Review" /> 

<apex:messages />

 <apex:form rendered="{!displaySection}"> 

<script type="text/javascript"> function LegalNameChangePopup(){ var newwindow = window.open('RELLegalNameChangePopup', 'name=_blank','height=500,width=500,left=250,top=100'); newwindow.focus(); } 

</script>

 <apex:pageblock title="General Information" > 

<apex:pageblocksection title="Legal Name"> 

<apex:panelgrid columns="2"> 

<!-- <apex:outputlabel value="Account Name: " for="accountName" />-->

 <apex:outputfield id="accountName" value="{!aaccount.name}"/>

 <apex:commandbutton value="Edit" id="accpopup" onclick="LegalNameChangePopup();" styleclass="btn"/>

 </apex:panelgrid>

 </apex:pageblocksection> 

</apex:pageblock> 

<apex:pageblock > 

<apex:pageblocksection columns="4"> 

<apex:commandbutton action="{!step2}" value="Save and Continue" styleclass="btn" />

 <apex:commandbutton action="{!reset}" value="Reset Page" styleclass="btn" immediate="true"/>

 </apex:pageblocksection>

 </apex:pageblock> 

</apex:form>

 </apex:page>

VF for popup: RELLegalNameChangePopup

<apex:page standardcontroller="UCF_REL__c" extensions="UCFController" showheader="false" sidebar="false" id="the">

  <apex:form id="page"> 

<apex:pageBlock >

 <apex:pageBlockSection columns="1" title="Legal Name change"> 

<apex:pageblocktable value="{!aAccount}" var="item" id="editAccountName">

 <apex:column headervalue="Proposed Legal Name">

 <apex:inputtext value="{!item.Name}" />

 </apex:column> </apex:pageblocktable>

 </apex:pageBlockSection> 

</apex:pageBlock>

 </apex:form>
16 answers
  1. Jun 5, 2018, 9:10 PM
    Hi DeepV,

    Please refer the code below which will open a popup with a parameter from the parent page.

    <apex:page standardcontroller="Account" extensions="acctControllPopup" sidebar="false" >

    <apex:sectionheader title="UCF Review" />

    <apex:messages />

    <apex:form rendered="{!displaySection}">

    <script type="text/javascript">

    function LegalNameChangePopup(nameId){

    var name = document.getElementById(nameId).value;

    var url="/apex/popQuestionPagewhichWillOpen?namePp=" + name;

    var newwindow = window.open(url,'Popup','height=500,width=600,left=100,top=100,resizable=no,scrollbars=yes,toolbar=no,status=no');

    newwindow.focus(); }

    </script>

    <apex:pageblock title="General Information" >

    <apex:pageblocksection title="Legal Name">

    <apex:inputText size="40" value="{!accountName}" id="targetName"/>

    <apex:panelgrid columns="2">

    <!-- <apex:outputlabel value="Account Name: " for="accountName" />-->

    <apex:outputfield id="accountName" value="{!account.name}"/>

    <apex:commandbutton value="Edit" id="accpopup" onclick="LegalNameChangePopup('{!$Component.targetName}');" styleclass="btn"/>

    </apex:panelgrid>

    </apex:pageblocksection>

    </apex:pageblock>

    <apex:pageblock >

    <apex:pageblocksection columns="4">

    <apex:commandbutton action="{!step2}" value="Save and Continue" styleclass="btn" />

    <apex:commandbutton action="{!reset}" value="Reset Page" styleclass="btn" immediate="true"/>

    </apex:pageblocksection>

    </apex:pageblock>

    </apex:form>

    </apex:page>

    Controller (acctControllPopup)-

     

    public with sharing class acctControllPopup {

    public string accountName{get;set;}

    public string namePara{get;set;}

    Public string namePp;

    public string nameAcct;

    public acctControllPopup(ApexPages.StandardController controller) {

    displaySection=true;

    nameAcct= ApexPages.currentPage().getParameters().get('namePp');

    nameAcct= '%'+nameAcct+'%';

    system.debug('nameAcct '+nameAcct);

    aAccount = [Select Id,Name from Account where name like :nameAcct];

    }

    public List<account> aAccount{get;set;}

    public boolean displaySection{get;set;}

    public pageReference step2(){

    return null;

    }

    public pageReference reset(){

    return null;

    }

    public pageReference setPara(){

    //pageReference pageRef = new pageReference('/apex/popQuestionPagewhichWillOpen');

    //pageRef.getParameters().put('namePp', namePara);

    return null;

    }

    }

    Its a very basic one but it will probably get your job Done.

    I hope it helps.
0/9000