Click to See Complete Forum and Search --> : Change intially selected option on parent window


benniog
09-26-2006, 03:25 AM
Hi all,
This is my first post so hope you can help.

I have two forms on two seperate pages. The first form contains a drop down containing a list of Authors. From this first form you can open a popup window that contains a form that allows you to add an author. When the user submits the form I want the child window to close and the parent window to refresh and change the intially selected author from the authors list to the new one. The code that I am using at the moment is:

function closepopUp(i) {
opener.location.reload(true);
opener.document.marginForm.author_id.options[i].selected=true;
self.close();
}

marginForm = name of form
author_id = name of drop down (select menu)

I am calling this function from the popup window but it doesnt seem to work.
Can anyone provide me with any pointers - i'm getting desperate

Thanks in advance
Gary

Kor
09-26-2006, 03:32 AM
The moment you reload(true) the opener, the javascript relationship opener/popup is broken, and both pages are now independent. javascript is a client-side language, thus when the session is closed, javascript died.

You might try cookies, or you my try passing a parameter via address bar, but I guess that this kind of job is to be done better with a server-side application, for instance php or asp

benniog
09-26-2006, 04:35 AM
Hi Kor,
Thanks for the quick response, i thought that might be the case - i will have a go at using session variables. Will post my solution back here for future reference

Thanks
G