maggiemel
Posts: 75
|
| Posted: 08/26/2005, 8:04 AM |
|
I use the Smart Lookup from the example pack -- I love it. But now I want to be able to call the pop-up window from several different pages (several different forms/pages require this same value), but I'm having trouble with the conditional statement that will send the selected value back to the correct parent page. My function looks like this:
function SetOpenerValue(SelectedValue)
{
window.opener.document.form.fieldname.value = SelectedValue;
window.opener.focus();
window.close();
}
So I guess I need some kind of conditional statement to determine which window opened the pop-up so I can change this line:
window.opener.document.form.fieldname.value = SelectedValue
depending upon which parent page opened the window -- ??
Something like:
if window.opener = parent1 then
window.opener.document.form1.fieldname1.value = SelectedValue
else if window.opener = parent2 then
window.opener.document.form2.fieldname2.value = SelectedValue
end if
It seems so simple, but I can't make it work. Any help would be greatly appreciated.
_________________
Melissa Cahill
http://www.hellcatmaggie.net/ |
 |
 |
DonB
|
| Posted: 08/26/2005, 1:54 PM |
|
Just establish a convention for your 'receiving' fields - give them the same
id attribute (e.g., id='field1').
Now you can find them by id: document.getElementById('fieldname1').value =
SelectedValue;
The parent page is already identified by window.opener, so now you have
complete independence from having to know the difference between multiple
pages. Your data goes to the fields with the apppropriate ids on whichever
page opened the popup.
--
DonB
http://www.gotodon.com/ccbth
"maggiemel" <maggiemel@forum.codecharge> wrote in message
news:2430f2f694fa33@news.codecharge.com...
> I use the Smart Lookup from the example pack -- I love it. But now I want
to be
> able to call the pop-up window from several different pages (several
different
> forms/pages require this same value), but I'm having trouble with the
> conditional statement that will send the selected value back to the
correct
> parent page. My function looks like this:
>
> function SetOpenerValue(SelectedValue)
> {
> window.opener.document.form.fieldname.value = SelectedValue;
> window.opener.focus();
> window.close();
> }
>
> So I guess I need some kind of conditional statement to determine which
window
> opened the pop-up so I can change this line:
>
> window.opener.document.form.fieldname.value = SelectedValue
>
> depending upon which parent page opened the window -- ??
>
> Something like:
>
> if window.opener = parent1 then
> window.opener.document.form1.fieldname1.value = SelectedValue
> else if window.opener = parent2 then
> window.opener.document.form2.fieldname2.value = SelectedValue
> end if
>
> It seems so simple, but I can't make it work. Any help would be greatly
> appreciated.
> _________________
> Melissa Cahill
> http://www.hellcatmaggie.net/
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
Tuong Do
|
| Posted: 11/13/2005, 9:43 PM |
|
Hi maggiemel,
Create a java script function within your each of the parent window then
call it from your popup window
eg in each of the parent window create function call setValue and do what
ever you want in this function
then in your SetOpenerValue function do this
function SetOpenerValue(SelectedValue)
{
window.opener.setValue();
window.opener.focus();
window.close();
}
"maggiemel" <maggiemel@forum.codecharge> wrote in message
news:2430f2f694fa33@news.codecharge.com...
>I use the Smart Lookup from the example pack -- I love it. But now I want
>to be
> able to call the pop-up window from several different pages (several
> different
> forms/pages require this same value), but I'm having trouble with the
> conditional statement that will send the selected value back to the
> correct
> parent page. My function looks like this:
>
> function SetOpenerValue(SelectedValue)
> {
> window.opener.document.form.fieldname.value = SelectedValue;
> window.opener.focus();
> window.close();
> }
>
> So I guess I need some kind of conditional statement to determine which
> window
> opened the pop-up so I can change this line:
>
> window.opener.document.form.fieldname.value = SelectedValue
>
> depending upon which parent page opened the window -- ??
>
> Something like:
>
> if window.opener = parent1 then
> window.opener.document.form1.fieldname1.value = SelectedValue
> else if window.opener = parent2 then
> window.opener.document.form2.fieldname2.value = SelectedValue
> end if
>
> It seems so simple, but I can't make it work. Any help would be greatly
> appreciated.
> _________________
> Melissa Cahill
> http://www.hellcatmaggie.net/
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
|