+ Start a Discussion
ssssssss 

How to dispaly child window list value into parent window textbox

Hi Everyone,

 

In my appliaction parent window is having 3 fields and one link is there.when we click on the link child window opens and dispalys the lsit of values as picklist.

My requirement is display the child window picklist value into parent window text box.I am able to dispaly the values in child window.plz tell me how to display the value from child window to parent window.

 

My code is as follows.

 

Parent window VF page:

 

<apex:page standardController="CAF_Charge__c" extensions="g_popupwindow">
<h1> CAF Charge Detail </h1>
<apex:form >
<table>
 <tr>
  <td>
    <apex:outputText value="Charges Head"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <apex:inputText value="{!parentTextId}"/>
    <apex:commandLink value="search" onclick="popup('/apex/ge2')"/><br/>
  </td>
 </tr>
 <tr>
  <td>
    <apex:outputText value="Description Of Charges"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <apex:inputtext value="{!doc}"/>
  </td>
 </tr>
 <tr>
  <td>
    <apex:outputText value="Percentage"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <apex:inputtext value="{!percentage}"/>  
  </td>
 </tr>
<tr>
   <td>
    <apex:commandButton action="{!save}" value="Save"  />
    <apex:commandButton value="New"  />
   </td>
</tr> 
</table>


<script>
function popup(url)
{
    newwindow=window.open(url,'name','width=400,height=400,top=0,toolbar=no,personalbar=no,location=no,directories=no,statusbar=no,menubar=no,status=no,re sizable=yes,left=60,screenX=60,top=100,screenY=100');
    if (window.focus)
    {
     newwindow.focus()
    }
}
</script>

</apex:form>
</apex:page>

 

Child window VF page:

 

<apex:page standardController="CAF_Charge__c" extensions="g_popupwindow">
<apex:form >
<apex:pageblock >
<apex:pageBlockSection >
      <apex:pageblocksectionItem >
          <apex:outputlabel value="Charges Head" for="values" />     
          <apex:selectList value="{!selectedRecordId}" size="1" id="values">
          <apex:actionSupport event="onchange" reRender="Course" action="{!something}"/>
               <apex:selectOptions value="{!ChargeNames}"/>
           </apex:selectList>
      </apex:pageblocksectionItem> 
      <apex:pageBlockSectionItem >
           <apex:selectRadio value="{!selectedRecordId1}" id="Course" layout="pageDirection" >
                <apex:selectOptions value="{!Charge_Field}"/>
                <apex:actionSupport event="onchange" action="{!nothing}" status="status" reRender="btnsave,btncncel"/>
             </apex:selectRadio>
       
      </apex:pageblocksectionItem>                                                       
                    
  </apex:pageblocksection>
 </apex:pageblock>
</apex:form>
</apex:page>

 

Controller:

 

public class g_popupwindow
{

    public g_popupwindow(ApexPages.StandardController controller) {
    }
      public string parentText;
      public string selectedRecord;
      public string selectedCharge;
     
      Public string chargeshead{get;set;}
      Public string doc{get;set;}
      Public string percentage{get;set;}
      public string chead;
      List<SelectOption> values = new List<SelectOption>();
      public string getparentTextId()
            {
       return parentText;
      }
      public void setparentTextId(string values)
      {     
        this.parentText=values;
      }
  
    public string getselectedRecordId()
    {
        return selectedRecord;
    }
    public void setselectedRecordId(string s)
    {     
        this.selectedRecord=s;
    }
    public string getselectedRecordId1()
    {
        return selectedCharge;
    }
    public void setselectedRecordId1(string s)
    {     
        this.selectedCharge=s;
    }
  
   
    public void something()
    {
    setselectedRecordId1(selectedRecord);
    }
    public void nothing()
    {
    }
    //....! Dispalying charge values as picklist
    public List<SelectOption> getChargeNames()
    {
      List<SelectOption> options = new List<SelectOption>();
      List<chiranjeevi__CAF_Charge__c> chargelist= new List<chiranjeevi__CAF_Charge__c>();
      chargelist = [Select chiranjeevi__Charges_Head__c FROM chiranjeevi__CAF_Charge__c ];
      options.add(new SelectOption('--None--','--None--'));
    
      for (Integer j=0;j<chargelist.size();j++)
      {
       options.add(new SelectOption(chargelist[j].chiranjeevi__Charges_Head__c,chargelist[j].chiranjeevi__Charges_Head__c));
      }
      return options;
    }
   
    //....! storing selected charge from picklist to radio buton here
   
    public list<selectoption> getCharge_Field() 
    {
      List<SelectOption> values = new List<SelectOption>(); 
      if(selectedRecord == NULL)      
      {
        values.add(new selectoption('','NONE'));
      }
       
      else
      {
         values.add(new selectoption('',' '+selectedRecord));
      }
         return values;
    }  
}

 

If any one knows plz guide me.

 

Thanks in advance,

Manu..