CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Javascript help for javascripting stupid-head (me).

Print topic Send  topic

Author Message
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/
View profile  Send private message
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/
>


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.