Insert selection results to opener's form

Discussion in 'Javascript' started by tomb, Nov 5, 2007.

  1. tomb

    tomb Guest

    I only understand the popup mechanism on an elementary level, but my
    task is a bit more complex than that. If anyone can provide a guideline
    or point me to one I would be most appreciative.

    I would like to add functionality like an email address book that opens
    in a popup, and then the selected email addresses are populated to the
    main window form text box. I can open the popup, and I can populate the
    list of email addresses, but I don't get how to interact between the two
    windows and send the results back to the main window.

    Is there some way of sending a reference to the text box to the popup
    window? If so, I can set the value. Or, if there is a better way than
    that, I'm all for it.

    Please help - I've been searching for this all night and day!

    Thanks in advance.

    Tom
     
    tomb, Nov 5, 2007
    #1
    1. Advertising

  2. tomb

    SAM Guest

    tomb a écrit :
    > I only understand the popup mechanism on an elementary level, but my
    > task is a bit more complex than that. If anyone can provide a guideline
    > or point me to one I would be most appreciative.
    >
    > I would like to add functionality like an email address book that opens
    > in a popup, and then the selected email addresses are populated to the
    > main window form text box. I can open the popup, and I can populate the
    > list of email addresses, but I don't get how to interact between the two
    > windows and send the results back to the main window.


    In the popup

    <select onchange="var k = this.selectedIndex;
    if(k==0) alert('Make a choice in this list');
    else {
    opener.document.forms[0].email.value = this.options[k].value;
    self.close();
    }">
    <option selected>e-mail contacts</options>
    <option value="">Tartempion Marc</option>
    <opt ...
    </select>


    In the main window

    <form ... >
    <p>e-mail : <input type=text name="email">
    <a href="adBook.htm" onclick="adBook();" target="adbk">address book</a>

    <script type="text/javascript">
    function adBook() {
    if(typeof(truc)=='undefined' || truc.closed)
    truc = window.open('','adbk','width=300,height=500');
    truc.focus();
    }
    </script>

    --
    sm
     
    SAM, Nov 7, 2007
    #2
    1. Advertising

  3. tomb

    tomb Guest

    Merçi, beaucoup!

    T

    SAM wrote:
    > tomb a écrit :
    >> I only understand the popup mechanism on an elementary level, but my
    >> task is a bit more complex than that. If anyone can provide a
    >> guideline or point me to one I would be most appreciative.
    >>
    >> I would like to add functionality like an email address book that
    >> opens in a popup, and then the selected email addresses are populated
    >> to the main window form text box. I can open the popup, and I can
    >> populate the list of email addresses, but I don't get how to interact
    >> between the two windows and send the results back to the main window.

    >
    > In the popup
    >
    > <select onchange="var k = this.selectedIndex;
    > if(k==0) alert('Make a choice in this list');
    > else {
    > opener.document.forms[0].email.value = this.options[k].value;
    > self.close();
    > }">
    > <option selected>e-mail contacts</options>
    > <option value="">Tartempion Marc</option>
    > <opt ...
    > </select>
    >
    >
    > In the main window
    >
    > <form ... >
    > <p>e-mail : <input type=text name="email">
    > <a href="adBook.htm" onclick="adBook();" target="adbk">address book</a>
    >
    > <script type="text/javascript">
    > function adBook() {
    > if(typeof(truc)=='undefined' || truc.closed)
    > truc = window.open('','adbk','width=300,height=500');
    > truc.focus();
    > }
    > </script>
    >
     
    tomb, Nov 8, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Urs Gubler
    Replies:
    0
    Views:
    172
    Urs Gubler
    Jul 2, 2003
  2. Marco Alting
    Replies:
    7
    Views:
    570
    Thomas 'PointedEars' Lahn
    Oct 30, 2003
  3. Yaron C.

    opener.opener ?

    Yaron C., Oct 30, 2003, in forum: Javascript
    Replies:
    4
    Views:
    240
    Yaron C.
    Nov 2, 2003
  4. Soren Schimkat
    Replies:
    0
    Views:
    114
    Soren Schimkat
    Jul 8, 2005
  5. window.opener, form.opener?

    , Jul 14, 2006, in forum: Javascript
    Replies:
    5
    Views:
    307
Loading...

Share This Page