SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    insert text from popup window to parent

    On my parent page I have a form with an input text field containing the value of a Customer name (pulled from a database). I also have an image link that, when clicked, will launch a popup window that performs a database lookup and displays all Customer names.

    What I'm looking for is a javascript solution to do the following:
    1. Each Customer name in the popup window be a hyperlink that, when clicked, will populate the Customer input text field on the parent page (thereby removing the text field's current contents).
    2. then, automatically close the popup window.

    Thanks,
    MM

  2. #2
    Beer Monster -Ox's Avatar
    Join Date
    Apr 2003
    Location
    sowth afreeka
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Script in your popup

    HTML Code:
    <script type="text/javascript">
      	function insertToPartent(text){
      	opener.document.formanme.inputelementname.value = text;
      	window.close();
      }
      </script>
    then the link that you create from the DB is

    HTML Code:
    <a href="javascript:insertToPartent('name here');">person name</a>


    Hope that works

    My postings are a natural product.
    The slight variations in spelling and grammar enhance its
    individual character and beauty and in no way are to be
    considered flaws or defects - http://www.guinnesspig.net

  3. #3
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perfect!!! Thanks.

  4. #4
    Beer Monster -Ox's Avatar
    Join Date
    Apr 2003
    Location
    sowth afreeka
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no prob
    My postings are a natural product.
    The slight variations in spelling and grammar enhance its
    individual character and beauty and in no way are to be
    considered flaws or defects - http://www.guinnesspig.net


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •