Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Setting the value of window.opener from popup window name

Reply
Thread Tools

Setting the value of window.opener from popup window name

 
 
Tony Farrell
Guest
Posts: n/a
 
      05-10-2004
Hi Everyone -

I have a data entry form that allows the user to click a button
and have that button popup a list of available values -

the code on the popup window uses the name of the form
to determine what field to populate on the opener...





function sendComment()

{
var x
x = document.canned_comment_form.lb1.value;
name = self.window.name;
if(name == "CMT1")
{
window.opener.document.main_form.comment_1_tb.valu e = x;
}

if(name == "CMT2")
{
window.opener.document.main_form.comment_2_tb.valu e = x;
}

if(name == "CMT3")
{
window.opener.document.main_form.comment_3_tb.valu e = x;
}

close();
}


Now - I have switched the data entry to a dynamic type of form -
where each section can have multiple comment boxes -


so the question i have is ....

how do i build the
window.opener.document.main_form.comment_3_tb.valu e = x;

line to replace the .comment_3_tb. with
the
name = self.window.name;


in other words -

i now have this line...
window.opener.document.main_form.comment_3_tb.valu e = x;

but i need it to be...
window.opener.document.main_form.[self.window.name].value = x;
(or whatever the syntax is correct)

please advise....

thanks
tony
 
Reply With Quote
 
 
 
 
Randy Webb
Guest
Posts: n/a
 
      05-10-2004
Tony Farrell wrote:

> Hi Everyone -


<snip>

>
> i now have this line...
> window.opener.document.main_form.comment_3_tb.valu e = x;
>
> but i need it to be...
> window.opener.document.main_form.[self.window.name].value = x;
> (or whatever the syntax is correct)


window.opener.document.forms['main_form'].elements[self.window.name].value=x;




--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
populate value from popup window to grid in parent window Harsha ASP .Net 0 11-05-2009 05:13 AM
Popup Window Popup Timing =?Utf-8?B?Sm9obiBXYWxrZXI=?= ASP .Net 3 11-04-2005 07:33 PM
New Popup Window from an existing Popup Window Raffi Javascript 4 08-12-2004 01:21 PM
Main > Popup > Popup > Close popup AND new URL in main? Jens Peter Hansen Javascript 7 06-19-2004 08:56 PM
New window.name value doesn't stick. Old value returns unless the window is refreshed Diana Javascript 1 04-06-2004 12:09 AM



Advertisments