You need to sign in to do that
Don't have an account?
to get values from child page(popup) to master page
Guys!
Am a newbie..
Please guide me in retreiving data from poup page to master page.
Scenario:
I have two pages master and popup pages,
Master page:
<apex:page id="opage" controller="dep" >
<script>
function pop()
{
var msgwindow=null;
var url="/apex/new1?val=";
var value = document.getElementById('{!$Component.opage.oform.oval}').value;
msgWindow = open(url+value,window,'resizable=no,width=200,height=400');
return false;
}
</script>
<apex:form id="oForm">
<apex:inputtext id="oval"/>
<apex:commandbutton value="pop" onClick="pop()"/>
</apex:form>
</apex:page>
popuppage:
<apex:page wizard="true" sidebar="false" controller="dep" id="mypage">
<script>
function setForm(name)
{
alert(name);
<!--window.parent.opener.document.getElementById('oval').value = document.getElementById('oval').value;-->
window.opener.document.getElementById('opage:oform:oval').value = name;
self.close();
return false;
}
</script>
<apex:form id="myform">
<apex:repeat value="{!depts}" var="a" id="rpt">
<apex:commandLink value="{!a.name}" id="oval" onclick=" return setForm('{!a.name}');"><br/>
</apex:commandlink>
</apex:repeat>
</apex:form>
</apex:page>
Whenever User clicks on pop button in master page, its directing to pop page and whenevr I select a value, window is not closing and value is also not sent to master page.
Please guide me at earliest....
Thanx in Advance.
I tried with this code(modal dialog) and i was successful....
Note:
Please turn off your development mode while using in Firefox.
Child Page
===============================================
<apex:page controller="GetDepartments" wizard="true">
<script>
function sendDept(deptName)
{
window.returnValue = deptName;
self.close();
}
</script>
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!depts}" var="d">
<apex:column headerValue="Department">
<a value="{!d.name}" onclick="sendDept('{!d.name}')">{!d.name}</a>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Parent popup
======================================
<apex:page id="page">
<script>
function getchild()
{
var popupstyle = "center:yes;resizable:no;dialogHeight:200px";
getdept = window.showModalDialog('/apex/SampleLookupChild','',popupstyle);
alert(getdept);
if(getdept != null)
document.getElementById('page:form:pInput').value = getdept;
}
/* function closepopup()
{
}*/
</script>
<apex:form id="form">
Department:<apex:inputText id="pInput"/><apex:commandButton value="LookIN" onclick="getchild()"/>
<apex:commandButton value="close" onclick="closepopup()"/>
</apex:form>
</apex:page>