+ Start a Discussion

open popup from list then return response from popup to original list

I have a visualforce page with a list on it.  I want to be able to click a button on that list and have it open a popup allowing the user to edit the item from the list.  Then on he popup they would hit a button to put the edited data back in the list and close the popup. My issue is that I am not sure how to tie the information all together.  

Here is my visualforce page:

<apex:pageblocktable value="{!LineItemList}" var="lil" border="0"  columnsWidth="60px, 200px, 200px" width="100%" >
<apex:column headerValue="Action">
<apex:commandButton value="X" />
<apex:column headerValue="Serial #">
<apex:inputField value="{!lil.SerialNo__c}"/>
<apex:column headerValue="Part #" >
<apex:inputField value="{!lil.Part_Number_2__c}"/>
<apex:column headerValue="Ship To Address" >
<apex:outputField value="{!lil.Display_Address__c}"/>
<span class="lookupInput">
<script type="text/javascript">function newPopup(url) {popupWindow = window.open(url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')}</script>
<apex:commandlink onclick="JavaScript&colon;newPopup('{!url}');">
<apex:param value="{!lil.ShipToAddress__c}"/>
<img src="/s.gif" alt="Ship To Address Lookup (New Window)"  class="lookupIcon" onblur="this.className = 'lookupIcon';" onfocus="this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" title="Ship To Address Lookup (New Window)"/>

Here is the popup page:

<apex:form >
<apex:pageBlock >
<apex:pageBlockSection columns="1" >
<apex:dataTable value="{!AllAddresses}" var="a" rules="rows" cellpadding="3px">
<apex:column width="80%" >
<apex:outputField value="{!a.Full_Address__c}"/>
<apex:column >
<apex:commandButton value="Select"/>
<apex:commandButton value="Add New"/>

 Here is the controller that both pages use:

public list<OrderLine__c> getLineItemList(){
	newLineItems = new list<OrderLine__c>();
	billA = [select Full_Address__c from Address__c where Account__c = :acct.id AND Default__c = true AND Type__c = 'Bill To'];
	shipA = [select Full_Address__c from Address__c where Account__c = :acct.id AND Default__c = true AND Type__c = 'Ship To'];    
	ol0 = new OrderLine__c();
	ol1 = new OrderLine__c();
	ol2 = new OrderLine__c();
	ol3 = new OrderLine__c();
	ol4 = new OrderLine__c();
	ol5 = new OrderLine__c();
	ol6 = new OrderLine__c();
	ol7 = new OrderLine__c();
	ol8 = new OrderLine__c();
	ol9 = new OrderLine__c();
	ol0.ShipToAddress__c = shipA.id;
	ol1.ShipToAddress__c = shipA.id;
	ol2.ShipToAddress__c = shipA.id;
	ol3.ShipToAddress__c = shipA.id;
	ol4.ShipToAddress__c = shipA.id;
	ol5.ShipToAddress__c = shipA.id;
	ol6.ShipToAddress__c = shipA.id;
	ol7.ShipToAddress__c = shipA.id;
	ol8.ShipToAddress__c = shipA.id;
	ol9.ShipToAddress__c = shipA.id;
	ol0.Display_Address__c = shipA.Full_Address__c;
	ol1.Display_Address__c = shipA.Full_Address__c;
	ol2.Display_Address__c = shipA.Full_Address__c;
	ol3.Display_Address__c = shipA.Full_Address__c;
	ol4.Display_Address__c = shipA.Full_Address__c;
	ol5.Display_Address__c = shipA.Full_Address__c;
	ol6.Display_Address__c = shipA.Full_Address__c;
	ol7.Display_Address__c = shipA.Full_Address__c;
	ol8.Display_Address__c = shipA.Full_Address__c;
	ol9.Display_Address__c = shipA.Full_Address__c;   
	newLineItems = new list<OrderLine__c>();
return newLineItems;
url = '/apex/rmaAddressLookup?id='+acct.id
public list<address__c> addressLookup = new list<address__c>();
    public list<address__c> getAllAddresses(){
        addressLookup = [select Full_Address__c from Address__c where Account__c = :apexPages.currentPage().getParameters().get('id')];
    return addressLookup;

 Any help you can give would be greatly appreciated.  Thanks. 


 Here is my controller: