PDA

View Full Version : problem with getting data back from popup window to parent window



meenakshi
05-31-2008, 11:44 AM
hi i m using javascript as front end and ms access as database for a standalone machine.i have been able to add a lot of things to the code thanks to codingforums and also dynamic forums:)
but here is a problem which i m facing
i wanna open a popup window and search the content and then get that content to the parent window but facing some error which i m unable to rectify.maybe you can suggest me some better way to get the same thing done here is the code

parent window


<script language="JavaScript">
function newWindow(file,window) {
msgWindow=open(file,window,'resizable=no,width=800,height=600');
if (msgWindow.opener == null) msgWindow.opener = self;
}
</script>
<body bgcolor="#FF9520" text="#FFFFFF" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<body onkeydown="javascript:if(window.event.keyCode == 13) window.event.keyCode = 9;">
<div>
<table>
<tr>
<td>
<p align="center"><font size="7" face="Times New Roman">
Alterations Data(Send Entry)</font></td>
</tr>
<tr>
<td>
<table>
<tr>
<td>
<table>
<tr>
<td>
<p align="right"><input type="button" value="Refresh" name="btnRefresh" tabindex="10" onclick = "ResetForm();">
<input type="button" value="Save" name="btnSave" tabindex="9" onclick = "SaveForm();"></td>
<td>
<p align="center">Client ID

<input type="text" name="txtClID" disabled="true" size="4">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table ><tr><td>
<form name="outputForm1" >
<table>
<tr>

<td><input type="button" value="Open window2" onClick="newWindow('new1.htm','window2')">
</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Delivery Date</td>
<td>
<input type="text" name="txtddate" tabindex="1" size="20">
</td>
<td>Alteration Number</td>
<td>
<input type="text" name="txtasno" tabindex="2" size="20">
</td>
</tr>
<tr>
<td>Customer Name</td>
<td>
<input type="text" name="txtnam1" tabindex="3" size="20">
</td>
<td>Mobile Number</td>
<td>
<input type="text" name="txtmobile" tabindex="4" size="20">
</td>
</tr>
<tr>
<td>Pieces</td>
<td>
<input type="text" name="txtpcs1" tabindex="5" size="20"></font>
</td>


<td>Sales Person Name</td>
<td>
<select name="txtsperson" tabindex="6">
<option value="Hemant">Hemant</option>
<option value="Rajan">Rajan</option>
<option value="Ranjan Kumar">Ranjan Kumar</option>
<option value="Sanjay Parwani">Sanjay Parwani</option>
<option value="Santosh">Santosh</option>
<option value="Rajesh">Rajesh</option>

</select>

</td>

</tr>
<tr>
<td>Details</td>
<td>
<input type="text" name="txtdesc1" tabindex="7" size="20">
</td>

<td>Remarks</td>
<td>
<select name="txtremarks" tabindex="8">
<option value="Normal">Normal</option>
<option value="Balance Pending">Balance Pending</option>
<option value="Home Delivery">Home Delivery</option>
<option value="Delivery At South Ex">Del. at South Ex</option>
<option value="Realter">Re-alter</option>
<option value="Repair">Repair</option>
<option value="Early Delivery 12 Noon">Early Delivery 12 Noon</option>
<option value="Early Home Delivery 12 Noon">Early Home Delivery 12 Noon</option>
<option value="Realter and Home Delivery">Re-alter n Home Del.</option>
<option value="Realter and Delivery At South Extension">Re-alter n Del.South Ex</option>
<option value="Balance Pending and Home Delivery">Balance Pending n Home Del.</option>
<option value="Balance Pending and Delivery At South Ex">Bal.Pending n Del.South Ex</option>
<option value="Balance Pending and Early Delivery 12 Noon">Bal.Pending n Del.12 Noon</option>
<option value="Balance Pending and Early Home Delivery 12 Noon">Bal.Pending n Home Delivery 12 Noon</option>

</select>


</td>

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

</table>
</body>


and the popup window code is


<script language="JavaScript">
function setForm() {
opener.document.outputForm1.txtasno.value = document.inputForm1.txtasno12.value;
opener.document.outputForm1.txtnam1.value = document.inputForm1.txtnam12.value;
opener.document.outputForm1.txtmobile.value = document.inputForm1.txtmobile12.value;
self.close();
return false;
}
</script>
<body bgcolor="#FF9520" text="#FFFFFF" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<body onkeydown="javascript:if(window.event.keyCode == 13) window.event.keyCode = 9;">
<div style="position: relative; width: 100%; height: 100%; z-index: 1" id="MainPage">
<table>
<tr>
<td>
<p align="center"><font size="7" face="Times New Roman">Alterations
Data(Receive Entry)</font></td>
</tr>

<tr>
<td>
<table>
<tr>
<td>
<table>
<tr>
<td>
<p align="right"><input type="button" value="Refresh" name="btnRefresh" tabindex="13" onclick = "ResetForm();">
<input type="button" value="Save" name="btnSave" tabindex="12" onclick = "SaveForm();"></td>
<td>
<p align="center">Client ID

<input type="text" name="txtClID" disabled="true" size="4">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table><tr><td>
<form name="inputForm1" onSubmit="return setForm();">
<table>
<tr>



<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Alteration Number</td>
<td>
<input type="text" name="txtasno12" disabled="true" tabindex="1" size="20">
</td>
<td>Customer Name</td>
<td>
<input type="text" name="txtnam12" disabled="true" tabindex="2" size="20">
</td>
<td>Mobile</td>
<td>
<input type="text" name="txtmobile12" disabled="true" tabindex="3" size="20">
</td>
<td>
<input type="submit" value="Update opener">
</td>
</tr>

</table>
</form>
</td></tr></table>
</td>
</tr>
<tr>
<td>
<table bgcolor="#9F0000">
<tr>
<td>
Search <input type="text" name="txtSearchPara" tabindex="14" onblur = "getSearchResults();" size="20">
</td>
</tr>
<tr>
<td>
<SPAN id= "SearchResultPanel" > </SPAN>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>

hope i m no bugging you guys with such a long code but i thought maybe the problem is in placing of the code maybe
pls help
smile always:)
anand

jscheuer1
05-31-2008, 03:38 PM
See:

http://www.dynamicdrive.com/forums/showpost.php?p=143662&postcount=5