SitePoint Sponsor

User Tag List

Results 1 to 13 of 13

Threaded View

  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2003
    Location
    l'Europe
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    pass values between popup and main window

    Hi,

    I'm making a php application where details on some data can being "choosed" from a popup window.
    On clicking a link, the popup opens with a result set. The user can click on the needed row and a variable is being passed on to the main window. The form in the main window is being submitted so details are being filled in with help of the passed variable.

    [Main window]
    this opens my popup:

    Code:
    <script type="text/javascript">
    var OpenSubX = (screen.width/2)-275;
    var OpenSubY = (screen.height/2)-150;
    var pos = "left="+OpenSubX+",top="+OpenSubY;
    
    function OpenSub(){
    OpenSub1Window = window.open("not.php?notid=<?=$notid?>","not","width=550,height=300,"+pos);
    }
    </script>
    ... opened with <a href="javascript:OpenSub()">this</a>

    [Popup window (not.php)]
    this transfers the value:

    Code:
    ]<script type="text/javascript">
    function SubForm(i)
    {
    window.opener.document.forms[0].notid.value=document.forms[i].notid.value;
    window.opener.document.forms[0].submit();
    window.close();
    }
    </script>
    ... being transfered with <input type="button" ... onClick="javascript:SubForm(<?=$i?>)" ...>

    It works perfect without the "i"s in the last function (as with just one row in the result set on the popup window).
    I added the "i" because a result list has more rows than one. So every row has its own mini-form with a button, a hidden notid-value and name "i"...

    On clicking a button in the result list, the value is being transfered correctly to the main window, it is being refreshed with the submit and the popup is being closed.

    But when I click on any link or button in the main window, nothing happens anymore.
    I've deleted the window.close-line of the function, but still no links/buttons are working after submitting the main form by the function...

    Can anyone helps me with what's happening here?
    Is there a better way in doing these things?

    Thank you very much for any suggestions!

    Ann
    Last edited by ann_dupont; May 31, 2003 at 06:47.


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
  •