SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Form

Hybrid View

  1. #1
    SitePoint Enthusiast alf's Avatar
    Join Date
    Aug 2000
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form

    Hello, I need some help here with javascript and form.

    My question is I need to parse back some data from a pop up page to the calling page form field. Anyway I can do this?

    Here is the sample code of what I am doing.

    This is the calling page which will pop up a new window:
    <SCRIPT language=Javascript>
    <!--
    function PopUp() {
    W = window.open('data.php', "WinA", "location=no,scrollbars=yes");
    }
    //-->
    </SCRIPT>
    <form name='IPP' method='post' action='<? echo($PHP_SELF) ?>'>
    <input class='Gen' type='text' name='name' size='30'>
    <a href='javascript:PopUp()' class='get'>Get Data</a>
    </form>

    And the data.php will list all data with link eg. aaa, bbb, ccc.

    So, what javasript code should I add to data.php when I click on aaa, it will pass back aaa to the calling page form IPP.name.value?

    Thanks.

  2. #2
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can use the "opener" property to reference form fields, variables and functions in the window that opened the popup. In your popup try this:
    opener.document.IPP.name.value="some text"

    opener refers to the window that opened the poupup.

  3. #3
    SitePoint Enthusiast alf's Avatar
    Join Date
    Aug 2000
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, thanks requestcode.
    It works....


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
  •