Setting the value of window.opener from popup window name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tony Farrell

    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.l b1.value;
    name = self.window.nam e;
    if(name == "CMT1")
    {
    window.opener.d ocument.main_fo rm.comment_1_tb .value = x;
    }

    if(name == "CMT2")
    {
    window.opener.d ocument.main_fo rm.comment_2_tb .value = x;
    }

    if(name == "CMT3")
    {
    window.opener.d ocument.main_fo rm.comment_3_tb .value = 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.d ocument.main_fo rm.comment_3_tb .value = x;

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


    in other words -

    i now have this line...
    window.opener.d ocument.main_fo rm.comment_3_tb .value = x;

    but i need it to be...
    window.opener.d ocument.main_fo rm.[self.window.nam e].value = x;
    (or whatever the syntax is correct)

    please advise....

    thanks
    tony
  • Randy Webb

    #2
    Re: Setting the value of window.opener from popup window name

    Tony Farrell wrote:
    [color=blue]
    > Hi Everyone -[/color]

    <snip>
    [color=blue]
    >
    > i now have this line...
    > window.opener.d ocument.main_fo rm.comment_3_tb .value = x;
    >
    > but i need it to be...
    > window.opener.d ocument.main_fo rm.[self.window.nam e].value = x;
    > (or whatever the syntax is correct)[/color]

    window.opener.d ocument.forms['main_form'].elements[self.window.nam e].value=x;




    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javas cript FAQ - http://jibbering.com/faq/

    Comment

    Working...