470,638 Members | 1,579 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,638 developers. It's quick & easy.

Setting the value of window.opener from popup window name

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
Jul 23 '05 #1
1 4754
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/
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by NeverLift | last post: by
5 posts views Thread by Hemanth | last post: by
1 post views Thread by Jessica | last post: by
1 post views Thread by Korara | last post: by
???
1 post views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.