|
I have followed directions from other websites on how to code to successfully pass data from a popup to a parent page but I cannot get the data to display on the parent page. Hoping someone can give me the missing link.
Here are my code snippets (BTW I am working with coldfusion but the passing code is javascript):
Parent page:
<cfform id="frmRelease" name="frmRelease" method="post" preservedata="yes" action="/forum/preview_action_edit.html" enctype="multipart/form-data" onsubmit="return submitForm();">
//hidden field that should hold the passed data. I have debug code that should show me the passed data once the page reloads but I never get the passed data displayed.
<input type="hidden" name="contactListing" />
<cfif isDefined("form.contactListing")><cfoutput> this is contact list #form.contactListing#</cfoutput><cfelse><cfoutput>there is no contact list </cfoutput></cfif>
<script language="JavaScript 1.2" type="text/javascript">
<!--
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=500,left = 190,top = 62');");
}
</script>
//where I call the popup
<legend>Contact <a href="javascript:popUp('/forum/contactList_id__ltcfoutput__gt_.html')">Select Contacts</a></legend>
Popup page:
//The page displays a number of selections for the user. I then collect the data on submit and create a variable to pass the data back to the parent. I have debug alerts that show me I do have data before I transfer and that I supposedly successfully transfer the data.
<cfform id="frmContact" name="frmContact" method="post" preservedata="yes" onsubmit="submitForm();window.close();">
<input type="hidden" name="contactList" />
<script language="javascript">
function submitForm()
{
alert("i am here");
var numContacts = document.frmContact.numberOfContacts.value;
for(i=1;i<=numContacts;i++){
if(eval('document.frmContact.order' + i + '.value')!=''){
if(isNaN(eval('document.frmContact.order' + i + '.value'))){
eval('document.frmContact.order' + i + '.select()');
alert('Please enter a proper value in the order box');
return false;
}
}
}
var contactArray=new Array();
var contactCounter = 0;
var passBackContacts = "";
for (i=1;i<=document.frmContact.numberOfContacts.value; i++){
if (passBackContacts != ""){
passBackContacts = passBackContacts + "," ;
}
if(eval('document.frmContact.order' + i + '.value')!=''){
contactCounter = contactCounter++;
contactArray[contactCounter] = eval('document.frmContact.order' + i + '.value')+","+eval('document.frmContact.contactID' + i + '.value');
passBackContacts=passBackContacts + eval('document.frmContact.order' + i + '.value');
}
else {
passBackContacts=passBackContacts+"0";
}
}
alert("test that we have data passbackcontacts = "+passBackContacts);
window.opener.document.frmRelease.contactListing.value =passBackContacts;
alert("after assignment");
opener.location.reload();
}
</script>
|
|
|
|
|
|
|
|