function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hisrinuhisrinu 

Problem in Lookup window using Visualforce

Hi,

  I am trying to built an lookup functionality using the visualforce. I am able to open a popup window as well as able to display the data on it. whenever I am closing the second page, it is not updating the value to the first page.

 

Here is my code

 

 

Parent Window:

<apex:page controller="popupwindow">
<apex:form >
<apex:inputtext value="{!textval}"/>
<apex:commandLink value="get" onclick="popup('/apex/childwindow')"/><br/>
<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:

<apex:page controller="popupwindow" sidebar="false">
<apex:form >
<apex:dataTable value="{!accounts}" var="a" cellPadding="4" border="1">
<apex:column headervalue="Account Name">
<apex:commandLink onclick="close1()" action="{!filltextval}">
<apex:param name="name1" value="{!a.Name}"/>
{!a.Name}</apex:commandLink></apex:column>
</apex:dataTable>
<script>
function close1()
{
<!-- parent.window.opener.location.reload(); -->
parent.window.close();
}
</script>
</apex:form>
</apex:page>

 

Controller:

public class popupwindow
{
Public string textval{get;set;}

Public List<Account> getAccounts()
{
List<Account> acclist = [select name from account limit 10];
return acclist;
}

Public void filltextval()
{
textval = apexpages.currentpage().getparameters().get('name1');
}

}

 In the controller I am able to set the value to that particular textfield, but I am not able to display the data in the Parent VF Page. If I reload the parent page entire data is getting lost.

 

Any Suggestions on this will be highly appreciable................

 

 

Message Edited by hisrinu on 02-09-2009 03:57 AM
ssssssss

Hi,

 

I am also facing the same problem.I was unable to pass the value from child window to parent window.If u found the solution plz give me the example code which will be more help ful to me.

 

Thanks in advance,

Manu..