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

passing values from one window to another window ...

Hi everyone i have created 2 visualforce pages as follows..code is as below..


Parent window(visualforce page 1)


<apex:page >

<form method=post action='' name=f1>
<table border=0 cellpadding=0 cellspacing=0 width=550> <tr>
<td ><font size=2 face='Verdana'>Your Name</font><input type=text name='p_name' size='8'>
<!--<a href="#" NAME="My Window Name" title=" My title here ""","Ratting",
"width=550,height=170,left=150,top=200,toolbar=1,status=1,");>Click here to open the child window</a>-->
<A href="javascript:void(0)"
Open a new window</A>

</td></tr> </table></form>



Child Window (visualforce page 2)


<apex:page >

<script langauge="javascript">
window.onLoad=new function()
function post_value(){
opener.document.f1.p_name.value = document.frm.c_name.value;

<title>(Type a title for your page here)</title>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">

<form name="frm" method=post action=''>
<table border=0 cellpadding=0 cellspacing=0 width=250>

<tr><td align="center"> Your name<input type="text" name="c_name" size=12 value=test>
 <body onload="post_value()"  style="font-family: Arial;border: 0 none;">
<input type=button value='Submit' onclick="post_value();">
<!-- <form action="#" onsubmit="post_value(); return false">-->


So in parent window when i click on link i can navigate to new window which is nothing but child window...


Now in child windowif i enter some input value and click submit button iam not able to pass this parti8cular value to the parent window but i want to pass values to the parent window whenevcer i click submit button...


So please help me to  do it..


                                                                                     Thanks and regards,



That is how you'd normally do it - capture the button click and then use javascript to populate the contents of a field in the parent window.


I'm not sure why you are trying to do anything with this as an onload handler - is that test code that you've left in?


I usually pass the id of the field that I want to update as a parameter to the child page, and then locate the element by id and write its value.


When you say yours isn't working, what happens - JavaScript errors, no updates to the field  etc? 


Hi bobs,


 Thanks for your reply,Iam not able to pass that value to the parent window when i click on submit button ,and iam not getting any errors. If u have any example of same type can u please share the code ...