Quick bit of Javascript help needed.
Discussion
I have a child window which I open in FancyBox to update the properties of a MySQL table row. On submit it automatically close and refreshes the table it was called from. It all works fine, but I now want to transfer the value of a radio button in the child form to the parent All I need to do is have the parent radio button take on the value of the checkbox on the child, ie: open or closed.
{{{
//============================================================+
//Used to close FancyBox and reload the calling page.
//============================================================+
function closeFB()
{
//window.opener.document.radioControls.statusRadio.value = document.updateForm.Status.value;
window.parent.location = window.parent.location.href;
parent.$.fancybox.close();
}
}}}
I can alter the syntax to window.parent.document etc... but that doesn't work either What am I missing?
{{{
//============================================================+
//Used to close FancyBox and reload the calling page.
//============================================================+
function closeFB()
{
//window.opener.document.radioControls.statusRadio.value = document.updateForm.Status.value;
window.parent.location = window.parent.location.href;
parent.$.fancybox.close();
}
}}}
I can alter the syntax to window.parent.document etc... but that doesn't work either What am I missing?
I got it working with the code below but then hit another problem. The refresh of the parent then sets it back to it's default radio button and I can't be arsed to code my way out of it right now
FancyBox is a lightbox type library that I use in conjunction with another (niftycorners) to get a mac style window with rounded corners and transparency to display an inline iframe with transparency etc. It creates a very swish looking borderless window for data input/update in seconds.
If anyone is interested the working code is below, I changed the name of the Radio during testing...
{{{
//============================================================+
//Used to update the calling page.
//============================================================+
function updateParent()
{
callStatusVal = 0;
for( i = 0; i < document.updateForm.callStatus.length; i++ )
{
if( document.updateForm.callStatus[i].checked == true )
callStatusVal = document.updateForm.callStatus[i].value;
}
//alert( "Call Status Value Is = " + callStatusVal );
if (callStatusVal=='Open'){
window.parent.statusRadioOpen.checked = true;
}
if (callStatusVal=='Closed'){
window.parent.statusRadioClosed.checked = true;
}
window.parent.location = window.parent.location.href;
}
}}}
FancyBox is a lightbox type library that I use in conjunction with another (niftycorners) to get a mac style window with rounded corners and transparency to display an inline iframe with transparency etc. It creates a very swish looking borderless window for data input/update in seconds.
If anyone is interested the working code is below, I changed the name of the Radio during testing...
{{{
//============================================================+
//Used to update the calling page.
//============================================================+
function updateParent()
{
callStatusVal = 0;
for( i = 0; i < document.updateForm.callStatus.length; i++ )
{
if( document.updateForm.callStatus[i].checked == true )
callStatusVal = document.updateForm.callStatus[i].value;
}
//alert( "Call Status Value Is = " + callStatusVal );
if (callStatusVal=='Open'){
window.parent.statusRadioOpen.checked = true;
}
if (callStatusVal=='Closed'){
window.parent.statusRadioClosed.checked = true;
}
window.parent.location = window.parent.location.href;
}
}}}
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff