ccurle
12-07-2006, 12:09 PM
I have a form that is a pop up window, and when you fill it out, the variables get sent to a javascript function in the parent window.
If I put in an alert in the function, I see that the variables are being passed, however, they aren't going past the function.
The form is to add a categoy. The function sends the variable to a php page and updates it via ajax. If I put this function on the parent page, it works, but when it comes from the pop up, the variables are there, but the function doesn't send the results to the php page.
Here is the code for the pop up
var newCat = null;
function addCat() {
if (newCat && !newCat.closed) newCat.close();
newCat = open('admin_create_category.php','newCat','left=300,top=85,width=350,height=270,status=0');
}
Here is the code in the pop up window
function setOpener(oForm) {
if (opener && !opener.closed) {
var newChanName = oForm.chanName.value;
var newChanDesc = oForm.chanDesc.value;
opener.addCategory('channelResult',newChanName,newChanDesc);
self.close();
return false;
}
}
Here is the function in the parent window that sends to php page
function addCategory(div_id,cn,cd) {
subject_id = div_id;
var channelID = document.program.Channel[document.program.Channel.selectedIndex].value;
http.open("GET", "admin_create_category_result.php?ChanName=" + escape(cn) + "&ChanDesc=" + escape(cd) + "&ChannelGK=" + escape(channelID), true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}
Like I said, if I run the function addCategory from the parent window, it works, but when it comes from the popup it doesn't.
I have added an alert(); to the addCategory function and the variables do show up.
Is there something I am not doing or need to do to make this run?
Thanks in advance.
If I put in an alert in the function, I see that the variables are being passed, however, they aren't going past the function.
The form is to add a categoy. The function sends the variable to a php page and updates it via ajax. If I put this function on the parent page, it works, but when it comes from the pop up, the variables are there, but the function doesn't send the results to the php page.
Here is the code for the pop up
var newCat = null;
function addCat() {
if (newCat && !newCat.closed) newCat.close();
newCat = open('admin_create_category.php','newCat','left=300,top=85,width=350,height=270,status=0');
}
Here is the code in the pop up window
function setOpener(oForm) {
if (opener && !opener.closed) {
var newChanName = oForm.chanName.value;
var newChanDesc = oForm.chanDesc.value;
opener.addCategory('channelResult',newChanName,newChanDesc);
self.close();
return false;
}
}
Here is the function in the parent window that sends to php page
function addCategory(div_id,cn,cd) {
subject_id = div_id;
var channelID = document.program.Channel[document.program.Channel.selectedIndex].value;
http.open("GET", "admin_create_category_result.php?ChanName=" + escape(cn) + "&ChanDesc=" + escape(cd) + "&ChannelGK=" + escape(channelID), true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}
Like I said, if I run the function addCategory from the parent window, it works, but when it comes from the popup it doesn't.
I have added an alert(); to the addCategory function and the variables do show up.
Is there something I am not doing or need to do to make this run?
Thanks in advance.