Hi DeepV, Please refer the code below which will open a popup with a parameter from the parent page.
Controller (acctControllPopup)-<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>
Its a very basic one but it will probably get your job Done.I hope it helps.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;
}
}
16 answers